Web 组件 - polyfill 不适用于 firefox 和 safari
Web component - polyfill not working on firefox and safari
我有一个简单的 index.html,其中导入了一个组件,exaclty 。
在 Chrome 上工作正常,但在其他浏览器(我试过 firefox 和 safari)上不行,它只显示 index.html 内容,而不显示组件的模板内容。我读了 ,这似乎是我的情况,但这个解决方案对我不起作用。
编辑:导入是正确的(来自 IDE,如果我命令+单击链接,我可以转到 .js)
这是因为 document.currentScript
不支持 polyfill。
你应该改用:
( document._currentScript || document.currentScript )
更新:或者您可以使用 new version of HTML Imports polyfill,使 document.currentScript
按预期工作。
我有一个简单的 index.html,其中导入了一个组件,exaclty
编辑:导入是正确的(来自 IDE,如果我命令+单击链接,我可以转到 .js)
这是因为 document.currentScript
不支持 polyfill。
你应该改用:
( document._currentScript || document.currentScript )
更新:或者您可以使用 new version of HTML Imports polyfill,使 document.currentScript
按预期工作。