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

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

From: Sean Hogan <shogun70@westnet.com.au>
Date: Thu, 24 Sep 2009 20:29:08 +1000
Message-ID: <4ABB49F4.3000308@westnet.com.au>
To: Garrett Smith <dhtmlkitchen@gmail.com>
CC: Mike Wilson <mikewse@hotmail.com>, Lachlan Hunt <lachlan.hunt@lachy.id.au>, public-webapps <public-webapps@w3.org>
Garrett Smith wrote:
> On Thu, Sep 24, 2009 at 12:02 AM, Mike Wilson <mikewse@hotmail.com> wrote:
>   
>> Yes, the base for event delegation is certainly something
>> like that. I just wanted to make clear that the main reason
>> for adding this functionality (IMO) is event delegation.
>> I'll let event delegation library creators chime in on the
>> details on what is needed for making really efficient
>> behavioural/delegation implementations, and judge the merits
>> of various optimizations. There has f ex already been mention
>> of caching "parsed" selectors.
>>
>>     
>
> The benefit to that is that the selector text is parsed once, so
> something like:-
>
> document.onmouseover = function(ev) {
>   if(ev.target.matchesSelector(".infotip")) { /*...*/ }
> };
>
> could probably be made more efficient as:-
>
> var selector = QuerySelector.create(".infotip");
> document.onmouseover = function(ev) {
>   if(selector.matches(ev.target)) { /*...*/ }
> };
>
>   

I would be surprised if an implementation didn't create an internal 
lookup table keyed off the selector text.
Received on Thursday, 24 September 2009 10:29:52 GMT

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