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

On Thu, Sep 24, 2009 at 11:21 AM, Lachlan Hunt <> 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 UTC