W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2005

[whatwg] getElementsBySelector etc

From: Sjoerd Visscher <sjoerd@w3future.com>
Date: Fri, 23 Sep 2005 00:05:48 +0200
Message-ID: <43332ABC.5080208@w3future.com>
Erik Arvidsson wrote:
> I'm writing this to 
> suggest a related method that takes an element and returns true if it 
> matches a CSS rule
> 
> interface GetElementsBySelector {
>   NodeList getElementsBySelector(in DOMString cssSelector);
> 
>   // returns true if an element matches the given CSS selector
>   boolean matchesSelector(in Element el, in DOMString cssSelector);
> }
> 
> I'm not too sure about the name of this method so suggestions for a 
> better name are welcome (as well as any other comment of course).
> 
> Another thing that just I'm not too sure about is whether these should 
> include pseudo classes? It would be good but it makes things harder to 
> implement.
> 
> In the light of the bindings and behaviors scenario it would also be 
> very useful to have observers so one call tell when the matching 
> changes. It might be outside the scope of web apps 1.0 though?

These features would be nice for all methods that return NodeLists. As 
NodeLists are live, adding a contains method, and a modification event 
to the NodeList interface should cover all you need and much more.

-- 
Sjoerd Visscher
http://w3future.com/weblog/
Received on Thursday, 22 September 2005 15:05:48 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:24 UTC