弄清楚为什么custom-element会在safari和firefox中显示,但不会在chrome中显示

时间:2014-06-06 13:32:25

标签: polymer

我试图弄清楚为什么自定义元素会在Safari和Firefox中显示,但不会在Chrome中显示。无论是在金丝雀还是在35.0.1916.114。 阴影dom在标志中启用。

我把快速的jsBin放在一起: http://jsbin.com/poracihi/4/

1 个答案:

答案 0 :(得分:1)

这是因为Chrome具有原生的Shadow DOM支持。您已经看到阴影dom边界的影响阻止了页面的样式流血。解决方案是将样式包含在元素的阴影中:http://jsbin.com/poracihi/5/edit

退房: - http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom-201/ - http://www.polymer-project.org/articles/styling-elements.html