W3C home > Mailing lists > Public > public-webapi@w3.org > March 2008

Re: [selectors-api] Why have two identical differently named interfaces?

From: Alex Russell <alex@dojotoolkit.org>
Date: Thu, 13 Mar 2008 04:53:02 -0700
Cc: "Web APIs WG (public)" <public-webapi@w3.org>
Message-Id: <01B4FDFA-48D0-46E0-934A-0811852D6F74@dojotoolkit.org>
To: liorean <liorean@gmail.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mar 12, 2008, at 8:46 AM, liorean wrote:

>
> On 12/03/2008, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>> I guess I could do the two interfaces, but I'm having a hard time  
>> seeing
>> different extensions being made to these two interfaces (as
> opposed to wholly
>> new interfaces being invented, as was done here).
>
> I can actually imagine one extension that only makes sence on elements
> and not on any other nodes - element-rooted instead of
> subtree-only-but-document-rooted queries. (I don't see any real
> benefit from such an interface though, but I've seen the idea
> mentioned on the mailing lists.)

The benefit here is the (potential) ability to root queries to  
containing nodes. Nearly every JavaScript library that does CSS  
selectors handles the equivalent of:

	node.querySelectorAll("> .thinger");

Which currently has no expression via valid CSS 3 selectors. There's  
no concept of a query being a descendant of a selector root node  
although the above use-case occurs very frequently in real-world  
scripts.

It seems foolish to extend the CSS 3 selectors WD to support a syntax  
that is simple-selector free, whereas it has use in the DOM-centric  
APIs.

Whether this needs to be handled via separate interfaces, I can't say  
(and don't care).

Regards

- --
Alex Russell
alex@sitepen.com  A99F 8785 F491 D5FD 04D7 ACD9 4158 FFDF 2894 6876
alex@dojotoolkit.org BE03 E88D EABB 2116 CC49 8259 CF78 E242 59C3 9723

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFH2RWfz3jiQlnDlyMRApYPAJ9Ya92ZUMdcyh7oll0uAjx383fsuQCeJWCU
4Qswwf04+na4fFHEL7A8TvU=
=ygzP
-----END PGP SIGNATURE-----
Received on Thursday, 13 March 2008 11:53:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 13 March 2008 11:53:45 GMT