Message from JavaScript discussions
November 2017
— Usually if I need a nodelist / collection / array I'll map it to something and throwaway the original instantly
Heh, I had to check MDN:
var item = myNodeList[i]; // Calling myNodeList.item(i) isn't necessary in JavaScript
— How about that
— I think it's because I read the DOM Core spec for a NodeList... whereas this looks like an extension from ECMA spec
— Hmm, yes, it's in WHATWG and not DOM Core, no wonder I missed it
—
interface NodeList {
getter Node? item(unsigned long index);
— There it is, plain as day XD
— I really hate WHATWG though because it can be specific like that sometimes, but other times you get weirdly vague stuff
— Like this
—
The appendChild(node) method, when invoked, must return the result of appending node to context object.
— And thus we have some janky return values sometimes... MDN had no information whatsoever on that until I added it
— I had to read Webkit source code to find out what is happening lol