@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.
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.
@bicknellr This has to do with the 2.0 preview branch
In
iron-iconset-svg
,applyIcon
tries to get the shadow root usingelement.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 aniron-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 setelement.root._svgIcon = svg
inapplyIcon
's return statement. This means that whenremoveIcon
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 iniron-icon
(because changing the icon runsapplyIcon
again).Here is a screenshot of what happens. 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.