Hacker News new | ask | show | jobs
by frio 4698 days ago
Contrived, but if I write:

    var allMyPageHeaders = HTML.find(".header");
    allMyPageHeaders[0].textContent = 'This is my main header';
... and there's only one element on the page with the class ".header", my code is now broken.

Unless I'm missing something, and an "HTML'ified node" acts as an array in the single case.

1 comments

Yep. You certainly can misuse it. You are supposed to do: allMyPageHeaders.only(0), because that works on a node or node list in HTML.js.