我没有在Chrome中使用多填充,而且在某些情况下,我看到我的自定义元素中的this.shadowRoot是#document-fragment而不是#shadow-root。
例如,下面是我的自定义元素中的一些代码,看看当我在调试器中悬停时它会说什么:

我还以为会见到#shadow-root呢。
是否有一个升级过程,在一小段时间内,最初,#document-fragment还不是#shadow-root
发布于 2019-01-29 17:34:35
shadowRoot属性应始终为#document-fragment / DocumentFragment类型。
接口ShadowRoot : DocumentFragment { 只读属性ShadowRootMode模式; 只读属性元素宿主; };
您应该只在元素窗格中看到#shadow-root。
您应该在“源”窗格中看到#document-fragment。
https://stackoverflow.com/questions/54426098
复制相似问题