Open davidmaxwaterman opened 9 years ago
This isn't really a problem in the shadow DOM, since elements are scoped (so the 'id' is only scoped to that particular instance of iron-iconset-svg
.). It is true that in the shady DOM we don't have this scoping, but we are working under the assumption that the shadow DOM is coming in all the browsers, and we are working with that future in mind -- in which case, in that future, this polluting will no longer happen.
Are you sure? It seems to me that the elements using 'id' are in light dom not shadow dom.
Please correct me if I'm wrong.
So, after some investigation on the Slack, we came to this conclusion:
The icon sets are indeed using id
s in their light DOM. The question isn't related to shadow/shady DOM:
https://github.com/PolymerElements/iron-icons/blob/master/iron-icons.html#L38
index.html
, in which case all of the SVG defs are in the main document's light DOM, and you can get ID collisions, because you have a ton of IDs like redo
and info
.FWIW, it appears to me that using IDs for SVG defs is the standard way to reference defs (and possibly the only way? I'm not sure):
http://www.w3.org/TR/SVG11/struct.html#Overview
The questions are:
id
here? (Or a way to use templates or shadow DOM to keep the little squeakers from leaking out?)index.html
? Copying @azakus who's familiar with both the iconsets and vulcanize ...
Handing this over to himself. If you think this is just something we should doc & live with, go ahead and assign it back to me and I'll Make It So.
We should consider using an alternate attribute for the unique ID (maybe name
?)
This issue still persists with Polymer 3.0
It seems to me this issue still applies :
https://github.com/Polymer/core-iconset-svg/issues/3
Is it not trivial to use some other attribute than 'id' to avoid conflicts with other ids used in the DOM?