Re: [whatwg] getElementsBySelector etc

2005-09-30 Thread Ian Hickson
On Mon, 19 Sep 2005, Erik Arvidsson wrote:
 
 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 agree that these would be useful. The former is even mentioned in the 
WA1 draft at the moment. However, it seems to me that this would be more 
in the realm of the CSSWG rather than the WHATWG.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] getElementsBySelector etc

2005-09-30 Thread Dimitri Glazkov
Just a barely relevant observation for the moment: CSS selectors
really ought to be their own language, separate from CSS spec. Kind of
like XPATH/XSLT relationship.

I am running with the microformats crowd (or should I say herd :)
occasionally, and the CSS selectors are a great fit for searching for
a format and doing things with it (trying carefully to skirt the
binding behavior religious debate :).

:DG

On 9/30/05, Ian Hickson [EMAIL PROTECTED] wrote:
 On Mon, 19 Sep 2005, Erik Arvidsson wrote:
 
  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 agree that these would be useful. The former is even mentioned in the
 WA1 draft at the moment. However, it seems to me that this would be more
 in the realm of the CSSWG rather than the WHATWG.

 --
 Ian Hickson   U+1047E)\._.,--,'``.fL
 http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
 Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



Re: [whatwg] getElementsBySelector etc

2005-09-30 Thread Ian Hickson
On Fri, 30 Sep 2005, Dimitri Glazkov wrote:

 Just a barely relevant observation for the moment: CSS selectors
 really ought to be their own language, separate from CSS spec. Kind of
 like XPATH/XSLT relationship.

They are:

   http://www.w3.org/TR/css3-selectors/

Notice that the name of the spec (despite the URI, which is that way for 
historical reasons) is just W3C Selectors, not W3C CSS Selectors.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] getElementsBySelector etc

2005-09-30 Thread Dimitri Glazkov
Doh! :)

Are there any languages at the moment that utilize Selectors other than CSS?

:DG

On 9/30/05, Ian Hickson [EMAIL PROTECTED] wrote:
 On Fri, 30 Sep 2005, Dimitri Glazkov wrote:
 
  Just a barely relevant observation for the moment: CSS selectors
  really ought to be their own language, separate from CSS spec. Kind of
  like XPATH/XSLT relationship.

 They are:

http://www.w3.org/TR/css3-selectors/

 Notice that the name of the spec (despite the URI, which is that way for
 historical reasons) is just W3C Selectors, not W3C CSS Selectors.

 --
 Ian Hickson   U+1047E)\._.,--,'``.fL
 http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
 Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



Re: [whatwg] getElementsBySelector etc

2005-09-30 Thread Ian Hickson
On Fri, 30 Sep 2005, Dimitri Glazkov wrote:
 
 Are there any languages at the moment that utilize Selectors other than 
 CSS?

I'm aware of several; STTS and a variant on the idea of STTS made by a 
Japanese group, in particular. There are also tools that use Selectors for 
various reasons.

None are particularly high-profile, though.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] getElementsBySelector etc

2005-09-22 Thread Sjoerd Visscher

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/


[whatwg] getElementsBySelector etc

2005-09-18 Thread Erik Arvidsson
We've seen a lot of use for getElementsBySelector lately for some 
javascript implementations of bindings and behaviors [1][2]. [1] use 
Simon Willison's implementation[3] and there is also one by Dean Edward[4].


I'm not writing this just to do some link dropping. 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?


[1] http://bennolan.com/behaviour/
[2] http://altas.asp.net
[3] http://simon.incutio.com/archive/2003/03/25/getElementsBySelector
[4] http://dean.edwards.name/my/cssQuery/

--
erik