Re: Elements array and query/queryAll methods
"Tab Atkins Jr." <[email protected]>
| Newsgroups | gmane.comp.web.dom.general |
|---|---|
| Message-ID | <CAAWBYDD6-a3HZo2wz0GtoCp1X1hdV2HVXkeJ4JPOFuR-U1m4Fw@mail.gmail.com> |
On Tue, Apr 8, 2014 at 11:35 AM, 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? Not to mention `Array.prototype.push.call(elementsObj, null)`. :/ ~TJ