PolymerElements / iron-iconset-svg

Represents a source of icons expressed as a collection of inline SVGs
https://www.webcomponents.org/element/PolymerElements/iron-iconset-svg
37 stars 33 forks source link

not removing icon #55

Closed e111077 closed 8 years ago

e111077 commented 8 years ago

@bicknellr This has to do with the 2.0 preview branch

In iron-iconset-svg, applyIcon tries to get the shadow root using element.root.

The first time this is run (I believe that this may be on attached) element.root seems to return a document fragment instead of the shadow root. It also seems as if the contents of that element (the element typically being an iron-icon) have not been stamped yet.

Every time after first render, it seems as if element.root is a proper shadow root. This causes issues because we set element.root._svgIcon = svg in applyIcon's return statement. This means that when removeIcon is run, it cannot remove the first icon which results in an icon in both the document fragment and the shadow root when you change the icon in iron-icon (because changing the icon runs applyIcon again).

Here is a screenshot of what happens. image The icon on the right was applied to the document fragment and the icon on the left was applied to the shadow root. The only one that toggles / changes when iron-icon.icon changes is the one on the left because we can now only access the shadow root.