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

有些话、适合烂在心里 提交于 2019-12-12 11:58:47

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/26702025/how-to-skip-the-shadow-dom-and-use-the-light-dom-instead-for-polymer-templates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!