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