Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/434.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript firefox/chrome中的content getDistributedNodes数组,但canary中的NodeList_Javascript_Html_Google Chrome_Polymer - Fatal编程技术网

Javascript firefox/chrome中的content getDistributedNodes数组,但canary中的NodeList

Javascript firefox/chrome中的content getDistributedNodes数组,但canary中的NodeList,javascript,html,google-chrome,polymer,Javascript,Html,Google Chrome,Polymer,我现在正在结帐。它有一些惊人的特点。 我有一个自定义元素,它使用getDistributedNodes访问一些分布式节点。 在chrome和firefox中,getDistributedNodes返回一个数组,而不是NodeList,但在chrome canary中,我得到一个NodeList 没有聚合物(更简单的例子是只使用shadowDom,没有自定义元素),我得到了chrome stable和chrome canary中的节点列表 其中哪一个应该是正确的返回值,是什么原因造成的 这是因为

我现在正在结帐。它有一些惊人的特点。 我有一个自定义元素,它使用
getDistributedNodes
访问一些分布式节点。 在chrome和firefox中,
getDistributedNodes
返回一个数组,而不是
NodeList
,但在chrome canary中,我得到一个
NodeList

没有聚合物(更简单的例子是只使用shadowDom,没有自定义元素),我得到了chrome stable和chrome canary中的节点列表

其中哪一个应该是正确的返回值,是什么原因造成的

这是因为在Chrome(stable)和其他浏览器中,Polymer使用了阴影DOM polyfill,它包装DOM对象。您无法本机创建
节点列表
,因此该调用通过返回数组来尽可能模仿本机API


金丝雀下(约:flags中的“实验性Web平台功能”),Polymer将使用本机Shadow DOM。原因是Canary有许多新的Shadow DOM功能/修复程序/性能优化尚未进入稳定通道。我们正在积极强制polyfill,直到它达到稳定:)

非常感谢。我看到chrome中有本机Shadow DOM,但我想它还不能使用。