Is NodeList returned by querySelectorAll live or static?
Answers:
The
NodeList
returned byquerySelectorAll
is static. This means that it represents a snapshot of the DOM at the moment the method is called. If the DOM changes after theNodeList
is created (for example, if nodes are added or removed), theNodeList
will not update to reflect those changes.In contrast, a "live"
NodeList
, such as those returned by properties likegetElementsByTagName
orgetElementsByClassName
, automatically updates when the DOM is modified.So, to summarize: the
NodeList
fromquerySelectorAll
does not change if the DOM changes after it is obtained.