Re: Elements array and query/queryAll methods
Rick Waldron <[email protected]>
| Newsgroups | gmane.comp.web.dom.general |
|---|---|
| Message-ID | <CAHfnhfqRUXv1_NyHp7eE=GKoCKf8MG+uRLkNx5wcr9H7PCbdiw@mail.gmail.com> |
On Tue, Apr 8, 2014 at 2:35 PM, Anne van Kesteren <[email protected]> wrote: > 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? > I don't immediately have an answer for that question ;) Rick