Re: Elements array and query/queryAll methods
Dean Edwards <[email protected]>
| Newsgroups | gmane.comp.web.dom.general |
|---|---|
| Message-ID | <CAJMHKgzxoF7g1Zi7ohKQXsvzLOSVGto-OWmWuund-mNoPcPH5A@mail.gmail.com> |
On 8 April 2014 19:13, Domenic Denicola <[email protected]> wrote: > From: Dean Edwards <[email protected]> > >> First of all it's counter-intuitive to how I'd expect it to work - the idea stemmed from jQuery's find() method which does not return duplicates. > > Hmm, perhaps I misunderstood---I thought you were talking about creating duplicates via `push` etc., but it sounds like you are worried about duplicates in the result of `queryAll`? If so, then yes, I agree there should not be duplicates in that result. It may be a mismatch between my "polyfill" (which was meant to be more illustrative than anything) versus the actual spec. Ah, fair enough then. But then I go back to my initial problem with it being difficult to polyfill without ES6 where we could at least use a Set to prevent duplicates. A polyfill that we could use today would be pretty slow compared to the existing querySelector(All) API. I have actually written a polyfill for the Elements class using real-world JS and it's horrible. :)