简体   繁体   English

在Polymer组件中找不到影子根,但是可以,为什么?

[英]No shadow-root found in Polymer component but works, why?

Polymer uses a Shadow DOM for its components as found at docs . docs所示, Polymer将Shadow DOM用于其组件。

Im investigating a very basic example of Hello-World in github: https://github.com/webcomponents/hello-world-polymer 我正在github中研究Hello-World的一个非常基本的示例: https : //github.com/webcomponents/hello-world-polymer

Im inspecting the demo and I cant find any shadow-root . 我正在检查演示但找不到任何影子根

I have worked with Polymer and I have used the shadow-root before, but why theres no shadow-root for this component? 我曾经与Polymer一起工作过,并且以前使用过shadow-root ,但是为什么没有此组件的shadow-root Because of some optimizations? 因为一些优化?

There is no shadow-root because they use the polyfilled Shadow DOM for v0 spec and not the current one supported by the browsers (v1). 没有shadow-root因为它们使用v0规范的多填充Shadow DOM,而不是浏览器(v1)支持的当前规范。

The demo you provided was built with Polymer 1 (according to hello-world.html source code since it uses Polymer() function and the deprecated HTML imports). 您提供的演示是使用Polymer 1构建的(根据hello-world.html源代码,因为它使用Polymer()函数和已弃用的HTML导入)。 Polymer 1 was built on top of Web Components v0 specs (Custom Elements v0, Shadow DOM v0 and HTML Imports) which are now deprecated and replaced by Shadow DOM v1 and Custom Elements v1. Polymer 1是在Web组件v0规范(自定义元素v0,Shadow DOM v0和HTML导入)的基础上构建的,现已弃用并由Shadow DOM v1和自定义元素v1代替。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM