For example I have this array object: Object [object HTMLDivElement],[object HTMLDivElement],[object HTMLDivElement],[object HTMLDivElement] and I need to change it to a kind of value that getElementsByTagName method returns, but without moving the nodes out of node tree into my new node list that is a live NodeList. My html elements in array ale already live and pointing to real elements in page, so for example adding an event is reflected in the page.
For example I have this array object: Object [object HTMLDivElement],[object HTMLDivElement],[object HTMLDivElement],[object HTMLDivElement] and
Share
You’ve misunderstood what ‘live’ means in the context of a NodeList.
Live NodeLists are variable length. They might contain 3 nodes one minute and 17 nodes the next. As you access and iterate over the NodeList the child/parent/sibling relationships are reevaluated to decide which nodes the NodeList should contain.
You cannot convert an arbitrary set of elements into a ‘live’ NodeList. It’s just an arbitrary set of elements.
Excerpt from Mozilla docs for getElementsByTagName: