Re: Elements array and query/queryAll methods

On 8 April 2014 19:13, Domenic Denicola <domenic@domenicdenicola.com> wrote:
> From: Dean Edwards <dean.edwards@gmail.com>
>
>> 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. :)

Received on Tuesday, 8 April 2014 18:24:41 UTC