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

Re: Selectors API Method Names

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Thu, 28 Jun 2007 20:20:37 +1000
Message-ID: <46838B75.4060304@lachy.id.au>
To: Maciej Stachowiak <mjs@apple.com>
CC: public-webapi <public-webapi@w3.org>

Maciej Stachowiak wrote:
> 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 
> functionality
> - 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

I don't agree with the last argument about text selection applying to 
these names, since the names clearly say Element, but in general, you 
make a very good case.

> 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.

In hindsight, looking at the arguments above, I probably did let my own 
personal dislike of the name get in the way of my objectivity in this 
case, as much as I tried to avoid doing so.  As such, I am now willing 
to consider these alternatives.

I'd have to make cssQuery() be the method that returns the node list 
because Dean Edward's implementation uses the same name to return an 
array.  The question is then what to call the singular method.

There has been an argument made that the shorter name should return the 
single element, though I don't believe it's particularly strong.  Since 
I can't think of any reasonable alternative shorter than cssQuery(), 
cssQueryOne() would be acceptable.

Would others accept changing the methods to cssQuery() and 
cssQueryOne()?  If this would achieve concensus, I'd be willing to use 
these names.

-- 
Lachlan Hunt
http://lachy.id.au/
Received on Thursday, 28 June 2007 10:20:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:57 GMT