小编flo*_*oor的帖子

Javascript选择器中的live和not live collection之间有什么区别?

我怎么知道live和not live collection之间的区别.

根据我的研究:

一个活的是:当DOM的变化反映了收藏.修改节点时,内容会受到影响.

A Not Live是:当DOM中的任何更改不影响集合的内容时.

document.getElementsByClassName()是一个HTMLCollection,并且是实时的.

document.getElementsByTagName()是一个HTMLCollection,并且是实时的.

document.getElementsByName()是一个NodeList并且是实时的.

document.querySelectorAll()是一个NodeList,不是实时的.

为什么document.querySelectorAll不活?

我知道 :

HTMLCollection仅包含元素节点 NodeList包含元素节点和文本节点.

javascript

8
推荐指数
1
解决办法
1835
查看次数

标签 统计

javascript ×1