I\'m generating content dynamically, so I\'m often ending up with documentFragments
which I\'m querying using querySelectorAll
or querySelector>
Unlike previously described element selection methods, the NodeList returned by querySelectorAll()is not live: it holds the elements that match the selector at the time the method was invoked, but it does not update as the document changes. [1]
The NodeList
in this case is not alive, so if you add/remove anything to/from it, then it won't have any effect on the document structure.
A NodeList is a read-only array-like object. [1]
[1]: JavaScript: The Definitive Guid, David Flanagan