Skip to content

webcomponent-bundle.js clones custom elements, prevents actual custom elements from working #63

@prushforth

Description

@prushforth
          > I noticed that when rendering features via the extension (if you put a build of this branch in the extension), you can't visually delete features that are [extension-rendered](https://maps4html.org/experiments/shared/restaurants/restaurants.xml) from the layer-.shadowRoot (within the console) i.e. it doesn't remove the linked \<g\> element when you do that.

I believe the "link" / "connection" between the map-feature element and <g> element is set up properly when the extension renders the map, so the codes should work as our expectation in this process:
image

I think the issue might be related to the webcomponent-bundle.js file. It seems that when we use the extension to render XML files, it may "clone" the custom elements we defined (layer-, map-feature, etc.) and attach the cloned element to the DOM instead of the ones that we create. If you remove the <layer- > element in the experiment (https://maps4html.org/experiments/shared/restaurants/restaurants.xml), you will notice that the layer is still present, just as we observed with <map-feature>. These "cloned" elements in the DOM do not have accessibility for any properties that we set (e.g. <layer- >._layer):
image

So even though the links between and feature elements that we created are properly set, they are not "reflected" to the "cloned" elements that we can handle in DOM.

Originally posted by @yhy0217 in Maps4HTML/MapML.js#801 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions