W3C home > Mailing lists > Public > public-html@w3.org > April 2014

Re: Elements array and query/queryAll methods

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 8 Apr 2014 11:43:19 -0700
Message-ID: <CAAWBYDD6-a3HZo2wz0GtoCp1X1hdV2HVXkeJ4JPOFuR-U1m4Fw@mail.gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
Cc: Rick Waldron <waldron.rick@gmail.com>, Dean Edwards <dean.edwards@gmail.com>, 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>
On Tue, Apr 8, 2014 at 11:35 AM, Anne van Kesteren <annevk@annevk.nl> wrote:
> On Tue, Apr 8, 2014 at 11:32 AM, Rick Waldron <waldron.rick@gmail.com> wrote:
>> 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);
>>   }
>>   ...
>> }
>
> How does this deal with arr[0] = string?

Not to mention `Array.prototype.push.call(elementsObj, null)`.  :/

~TJ
Received on Tuesday, 8 April 2014 18:44:07 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:16:38 UTC