From: Tab Atkins Jr. [[email protected]]
> NodeList is an interesting case, actually. It's an Array, but with a type
> restriction.
What do you mean by that? Surely you don't mean "can only store nodes":
```
> var nodeList = document.querySelectorAll("div");
undefined
> nodeList.length
22
> nodeList[22] = "not a node";
"not a node"
> nodeList[22]
"not a node"
```
On the other hand, not sure what's going on here:
```
> nodeList[1] = "not a node either";
"not a node either"
> nodeList[1]
<div class="banner">…</div>
> Object.getOwnPropertyDescriptor(nodeList, "1")
Object {value: div.banner, writable: true, enumerable: true, configurable: true}
```
(both results in Chrome 27. Firefox 21 has a different pathology... It returns
`undefined` for `nodeList[22]`, although `Object.isExtensible(nodeList) ===
true`. But it gets the second case right, giving `writable: false` to correctly
reflect the behavior there.)
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss