W3C home > Mailing lists > Public > public-webapi@w3.org > February 2006

Re: ACTION-87: Selectors API

From: Ian Hickson <ian@hixie.ch>
Date: Sat, 25 Feb 2006 23:56:32 +0000 (UTC)
To: Anne van Kesteren <annevk@opera.com>
Cc: "Web APIs WG (public)" <public-webapi@w3.org>
Message-ID: <Pine.LNX.4.62.0602252146190.315@dhalsim.dreamhost.com>

On Sat, 25 Feb 2006, Anne van Kesteren wrote:
> During the F2F I got an action assigned to me to draft something up for 
> getElementsBySelector(). Basically a method that would take a 
> selector[1] as argument and return a (static) list of elements. In the 
> current draft (attached) there is also an optional second argument that 
> takes an XPathNSResolver as argument. Might be a bit funny to see things 
> from the XPath API being reused in the one for Selectors, but it seemed 
> like the best and easiest solution.

Comments on the draft:

* It makes no sense for the UA to implement an interface. Objects that the 
UA exposes implement interfaces, not UAs.

* The UA doesn't need to expose an object that implements the NSResolver, 
only the author does.

* Having an interface doesn't imply behaviour -- e.g. NodeList doesn't 
imply that NodeList is live. You can have an object that implemnets 
NodeList and is not live.

* IMHO getElementsBySelector() should return a live list, just like 

* I would recommend against supporting namespaces in the first version, 
for simplicity.

* I would recommend having getElementsBySelector and 
getElementsBySelectorNS if you wanted to support both, rather than using 
optional arguments. Some languages don't support method overloading on 
argument signatures and would need different numbers of arguments anyway.

* There is no actual conformance criteria for what should happen when the 
getElementsBySelector method is invoked (the spec says "returns" not 
"must, when invoked, return").

* The spec doesn't say _how_ to resolve the namespaces using the 
nsresolver argument.

* IMHO the argument to getElementsBySelector should be a "group of 
selectors" not a "selector" (using Selectors terminology).

* IMHO the method should not raise an exception when the selector contains 
a pseudo-element. It should would return an empty list.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Saturday, 25 February 2006 23:56:44 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:19 UTC