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
Post a Comment