小编And*_*dre的帖子

webcomponents.js polyfills无法正常工作:Safari和Firefox

我正在尝试使用webcomponents.jspolyfill 使用自定义Web组件.我一直在使用https://github.com/webcomponents/hello-world-element中<hello-world>元素

Safari和Firefox不会显示任何内容并给我以下错误:

苹果浏览器: TypeError: null is not an object (evaluating 'thisDoc.querySelector('template').content')

火狐: TypeError: thisDoc.querySelector(...) is null

问题出在哪里:

我修改了hello-world.html.它现在记录模板querySelector的结果:

// Gets content from <template> console.log('thisDoc.querySelector("template")', thisDoc.querySelector('template')); var template = thisDoc.querySelector('template').content;

控制台输出给了我null. 这可能是其余代码无法工作的原因.有任何想法吗?

我的系统:

Safari: Version 8.0 (10600.1.25.1) Firefox: 31.0 OS: OS X Yosemite 10.10.1 (14B25)

我还在github发布了一个问题:https: //github.com/webcomponents/hello-world-element/issues/7#issuecomment-65321859

有没有人知道一个解决方案,让polyfills在Safari/Firefox中运行?谢谢!

javascript web-component web

6
推荐指数
1
解决办法
1445
查看次数

标签 统计

javascript ×1

web ×1

web-component ×1