Re: Elements array and query/queryAll methods

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:08 UTC