Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

createIconMap returns lots of non-icons when a complex icon contains paths with ids #41

Open
danishdynamite opened this issue Feb 18, 2016 · 1 comment

Comments

@danishdynamite
Copy link

I was writing a demo page for a custom iconset and was puzzled when it returned lots of stuff that was not icons at all.

It turns out the selector just looks for any element with an id-attribute, and I think that's a bit too lax. After I adjusted it to defs > g[id], it worked as I had expected it to, but then again, I don't know if this may ruin other stuff. Any comments?

    _createIconMap: function() {
      var icons = Object.create(null);
      Polymer.dom(this).querySelectorAll('defs > g[id]')
        .forEach(function(icon) {
          icons[icon.id] = icon;
        });
      return icons;
    },
@karolchmist
Copy link

We have the same problem when using svg with masks. Masks are referenced by ids and it pollutes the id space.

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

No branches or pull requests

2 participants