Re: Selectors API naming

Hi,

On Thu, 25 Jan 2007 19:26:38 +0100, Anne van Kesteren <annevk@opera.com>  
wrote:
> So the WG just discussed in a little over an hour a counter proposal to  
> the current naming[1] and came up with:
>
>  * getElementBySelectors()
>  * getElementListBySelectors()

I like get() and getAll() much better. They are shorter, more convenient  
and less likely to be typoed, especially the getElementListBySelectors  
(which tends to become getElementsListBySelectors or something).

get() is very straightforward, and anyone seeing a JS snippet like the  
following:

    var e = document.get("#nav ul");

....will immidiately understand what it does. It's true that they will  
probably also understand:

    var e = document.getElementBySelectors("#nav ul");

....but that's 18 characters longer, and from what I've heard and from  
personal experience, JS authors are already fed up with the  
getElementsByTagName() and getElementById() methods, being too long and  
hard to type.

Robert Sayre gave my permission to quote him from IRC:
> [20:48] <sayrer> wow, annevk
> [20:48] <sayrer> those names suck!
> [21:02] <zcorpan> sayrer: what names?
> [21:02] <sayrer> getElementsListBySelector
> [...]
> [21:03] * zcorpan likes get and getAll better
> [21:03] * sayrer notes that I got it wrong

Regards,
-- 
Simon Pieters

Received on Friday, 26 January 2007 04:51:58 UTC