How to skip Shadow DOM (and use Light DOM) instead of Polymer templates

Sometimes you may need to skip Shadow DOM entirely with Polymer.

+3


source to share


1 answer


You can force the template of a Polymer element into the Light DOM by overriding parseDeclaration

JS / Coffeescript in your declaration Polymer()

.

Coffeescript example:

Polymer "my-element",

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

      



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

Edit: if there is a better way to do this, please let me know.

+3


source







All Articles