Re: Elements array and query/queryAll methods

Anne van Kesteren <[email protected]>
Newsgroups gmane.comp.web.dom.general
Message-ID <CADnb78gH9Sxw3YSbtVN2u_36WbNFrrSQF_VhejprHD32_6xmmg@mail.gmail.com>
On Tue, Apr 8, 2014 at 11:32 AM, Rick Waldron <[email protected]> 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?


-- 
http://annevankesteren.nl/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.