Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"id" pollutes global namespace #17

Open
davidmaxwaterman opened this issue Jul 7, 2015 · 6 comments
Open

"id" pollutes global namespace #17

davidmaxwaterman opened this issue Jul 7, 2015 · 6 comments

Comments

@davidmaxwaterman
Copy link

It seems to me this issue still applies :

googlearchive/core-iconset-svg#3

Is it not trivial to use some other attribute than 'id' to avoid conflicts with other ids used in the DOM?

@notwaldorf
Copy link
Contributor

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.

@davidmaxwaterman
Copy link
Author

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.

@arthurevans
Copy link

So, after some investigation on the Slack, we came to this conclusion:

  • The icon sets are indeed using ids 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

  • This isn't really a problem in most cases, because the IDs are unique inside the import documents, and these imports don't get cloned into the the main doc, so there shouldn't be a conflict ...

  • Unless you vulcanize all of your files into 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:

  • are there any alternatives to using id here? (Or a way to use templates or shadow DOM to keep the little squeakers from leaking out?)
  • is there potential for collisions between icon sets?
  • do we need to caution people against vulcanizing everything into index.html?

Copying @azakus who's familiar with both the iconsets and vulcanize ...

@arthurevans
Copy link

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.

@notwaldorf
Copy link
Contributor

We should consider using an alternate attribute for the unique ID (maybe name?)

@touhonoob
Copy link

This issue still persists with Polymer 3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants