W3C home > Mailing lists > Public > public-html@w3.org > April 2014

Re: Elements array and query/queryAll methods

From: Dean Edwards <dean.edwards@gmail.com>
Date: Tue, 8 Apr 2014 18:39:49 +0100
Message-ID: <CAJMHKgzsiUW1wsbmsqza_TF32LkGZuphs4TLZmt1iWGDiquwOw@mail.gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
Cc: Travis Leithead <travis.leithead@microsoft.com>, Eric Devine <devineej@gmail.com>, "public-html@w3.org" <public-html@w3.org>, "www-dom@w3.org" <www-dom@w3.org>
The question I have about this proposal is how do we handle people
adding non-elements to the array?

    var elems = document.queryAll("p");
    elems.push(null);
    elems.queryAll("span");

Does the push throw an error? Or the subsequent queryAll call? Or is
the null value simply ignored?

Also, this is much harder to polyfill than the previous find(All)
proposal.The polyfill you linked to requires ES6 and I'm not convinced
it works anyway, won't it potentially allow duplicates in the
resulting Array?

-dean

On 8 April 2014 18:07, Anne van Kesteren <annevk@annevk.nl> wrote:
> Can we use www-dom@w3.org for the DOM? Also, please use
> http://dom.spec.whatwg.org/ as that's the canonical version.
>
>> From: Eric Devine
>>
>> What use cases is Elements intended to solve the NodeList and HTMLCollection
>> aren't suited for?
>
> It's meant to be a better API. E.g. have map and such.
>
>
>> What other functions return an Elements object?
>
> Just these for now.
>
>
>> Will there be a "live" Elements array?
>
> We should not introduce more live lists. They are bad.
>
>
>> Is Elements intended to replace the use of NodeList and HTMLCollection?
>
> Yes.
>
>
>> Where can I find the UA implementation status for these features?
>
> No implementation yet.
>
>
>> Does anyone know of a polyfill for either?
>
> https://gist.github.com/domenic/5864658 is an illustration of how this
> could be implemented going forward.
>
>
> --
> http://annevankesteren.nl/
>
Received on Tuesday, 8 April 2014 17:40:18 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:16:38 UTC