W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2009

Re: [selectors-api] Summary of Feature Requests for v2

From: Jonas Sicking <jonas@sicking.cc>
Date: Thu, 24 Sep 2009 12:38:41 -0700
Message-ID: <63df84f0909241238y6f334debs1504ef1ef049ca32@mail.gmail.com>
To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Cc: John Resig <jresig@mozilla.com>, public-webapps <public-webapps@w3.org>
On Thu, Sep 24, 2009 at 11:21 AM, Lachlan Hunt <lachlan.hunt@lachy.id.au> wrote:
>>> It would be great to have a separate, standalone, function that handles
>>>>
>>>> these merge/sort/unique operations for collections of DOM elements
>>>> (especially if they're disconnected from the document!).
>>>>
>>> The proposal from my previous mail falls into Option A.  Would it address
>>> this issue adequately?  Specifically, defining document.createSelector()
>>> and
>>> a Selector interface that allows running a query like this:
>>>
>>> var elements = [...] // Some Array (or NodeList) of Elements
>>> var selector = document.createSelector("em, strong");
>>> var list = selector.querySelectorAll(elements);
>>>
>>> This is equivalent to iterating over the elements array, running
>>> elements[i].querySelectorAll("em, strong") on each, and then
>>> merging/sorting
>>> all of the results into a single collection.
>>
>> Not a huge fan of that - it seems really backwards.
>
> Could you elaborate?

I had the same reaction as John, though quite possibly for different reasons.

Currently we have an API like node.querySelector(selector). Your
proposed API is selector.querySelector(node). That seems backwards
compared to existing API.

Quite possibly a namechange would make things better though.

/ Jonas
Received on Thursday, 24 September 2009 19:39:40 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:33 GMT