4

Sometimes you may want to skip the Shadow DOM completely with Polymer.

Erik Nomitch
  • 1,575
  • 13
  • 22

1 Answers1

3

You can force your Polymer Element's template into the Light DOM by overriding parseDeclaration on your Polymer() JS/Coffeescript declaration.

Coffeescript Example:

Polymer "my-element",

  parseDeclaration: (elementElement) ->
    @lightFromTemplate(@fetchTemplate(elementElement))

Of course, you have to be careful because if you have anything that belongs in the Shadow DOM (like a stylesheet) in your template, it will now be in the Light DOM.

Edit: If there's a better way to do this, please let me know.

Erik Nomitch
  • 1,575
  • 13
  • 22
  • Just to know...What would be a use case for this? could you provide an example? – sesteva Nov 03 '14 at 19:49
  • Sure, I was using this to test [hacking Select2 into a Polymer element](http://stackoverflow.com/questions/22887814/polymer-select2-element/26701948#26701948). It needed to get the offset of the Select2 element but the Shadow DOM always returned 0. – Erik Nomitch Nov 06 '14 at 17:04