W3C home > Mailing lists > Public > public-webapi@w3.org > June 2007

Re: Selectors API Method Names

From: Maciej Stachowiak <mjs@apple.com>
Date: Thu, 28 Jun 2007 01:22:30 -0700
Message-Id: <1499DCE2-5358-4E9D-9F89-40D49D79C75F@apple.com>
Cc: public-webapi <public-webapi@w3.org>
To: Lachlan Hunt <lachlan.hunt@lachy.id.au>

Hi Lachlan,

On Jun 22, 2007, at 10:23 PM, Lachlan Hunt wrote:

> *Conclusion*
> After carefully considering all of these reasons, I have update the  
> spec to use selectElement() and selectAllElements(), based on the  
> arguments given above.
> http://dev.w3.org/cvsweb/~checkout~/2006/webapi/selectors-api/ 
> Overview.html?content-type=text/html;%20charset=UTF-8

I can live with your suggested names, however, I think cssQuery()  /  
cssQueryAll() or cssQueryOne() / cssQuery() might be a better  
compromise choice.

Arguments against cssQuery:

- Selectors are not just called "Selectors", not "CSS Selectors", and  
using "css" in the API may lead people to think selectors are only  
for CSS

Arguments for cssQuery:

- Significantly shorter than selectElement()
- Already the name used by some JS implementations of the spec's  
- Authors often informally refer to this kind of feature as a "CSS  
query API"
- In practice, the vast majority of the time selectors are used in  
conjunction with CSS

Arguments for selectElement:

- Similar to the word "Selector"

Arguments against selectElement:

- Longer than cssQuery
- Very easily confusable with XPath selectSingleNode/selectNodes  
which are actively used in web content (enough that we implemented  
XPath in WebKit, and we include those methods)
- Very easily confusable with the UI operation of text selection, but  
are actually totally unrelated to, say window.selection

For me the bottom line is that while cssQuery may be somewhat  
imprecise, it is at the very least not ambiguous or confusable with  
very different operations. I think the desire to stop propagating an  
already common and relatively harmless misconception is outweighed by  
the potential for genuine confusion.

I hope you will consider these arguments, as well as Bjoern's  
objection, but I'm happy to leave the decision to you, as long as the  
name does not end up outrageously long.

Received on Thursday, 28 June 2007 08:22:41 UTC

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