Why is the JavaScript NodeList immutable? -


recently came across fact childnodes property of element returns nodelist , not array. understand nodelist meant live collection of elements, don't why precludes having methods indexof, or push.

could explain why thing can nodelist index it?

because that's way it's specified. dom api designed separately javascript. fact nodelist has common aspects javascript arrays (length , indexing) just...well, it's not coincidence, by-product of inputs design process. remember javascript not language has dom bindings.

you can readily affect contents of nodelist using dom api:

...or of course, favorite javascript library.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -