How do I enable Shady DOM in Polymer 2.0?

Deadly 提交于 2019-11-30 13:54:19

The Shady DOM shim was factored out of Polymer in 2.0 and moved into the v1 Web Components polyfill.

To enable Shady DOM (instead of the default Shadow DOM), define the following window.ShadyDOM object before importing the v1 webcomponents-lite.js:

<script>window.ShadyDOM = { force: true };</script>
<script src="webcomponentsjs/webcomponents-lite.js"></script>

codepen

UPDATE: A simpler setting is to specify [shadydom] on the <script> tag:

<script src="webcomponentsjs/webcomponents-lite.js" shadydom></script>

codepen

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