HTMLCollection
is a collection of elements (element nodes). HTMLCollection
can also contain non-HTML elements (compare for example with NodeList
). This is because the name was chosen before modern DOM emerged. HTMLCollection
is considered an old style collection and «a historical artifact we cannot get rid of». If possible, sequence<T>
should be used instead. item() | |
length | |
namedItem() |
HTMLCollection
is a live object, the documentation recommends to make a copy with Array.from()
. HTMLCollection
is for example returned by