MutationRecord.addedNodes returns NodeList with nodes detected as added in my document. When I use obj.appendChild() method, mutationObserver detects it and returns this ONE node in MutationRecord.addedNodes as nodelist [node]. When I use .appendChild() in loop, mutationObserver fires as many times as the number of loops amounts.
I'm just wondering if there is any case when mutationOvserver will detect more than one node added simultaneously and fire ONCE and return those nodes in MutationRecord.addedNodes as ONE nodelist [node,node,node,...]?
Judging by the spec one
appendChild
corresponds to a single-nodeaddedNodes
array.addedNodes
usually contains many nodes during the initial page load and, naturally, if many nodes were inserted by js code in one operation viainsertAdjacentHTML
, ordocument.write
, or.innerHTML
, or.outerHTML
, or DocumentFragment with many nodes.