- From: Rick Waldron <waldron.rick@gmail.com>
- Date: Tue, 8 Apr 2014 14:32:23 -0400
- To: Dean Edwards <dean.edwards@gmail.com>
- Cc: Anne van Kesteren <annevk@annevk.nl>, Travis Leithead <travis.leithead@microsoft.com>, Eric Devine <devineej@gmail.com>, "public-html@w3.org" <public-html@w3.org>, "www-dom@w3.org" <www-dom@w3.org>
- Message-ID: <CAHfnhfr3s3bSQ2KVW9ZGA0q96TT4-s+thR6wTx8_TYUKU-ZRNQ@mail.gmail.com>
On Tue, Apr 8, 2014 at 1:39 PM, Dean Edwards <dean.edwards@gmail.com> wrote: > The question I have about this proposal is how do we handle people > adding non-elements to the array? > > var elems = document.queryAll("p"); > elems.push(null); > elems.queryAll("span"); > class Elements extends Array { ... push(...elems) { // not necessarily instanceof, but some kind of check that's similar: if (!elems.every(elem => elem instanceof Element)) { throw some exception } super(...elems); } ... } Rick
Received on Tuesday, 8 April 2014 18:33:12 UTC