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

Re: Selectors API naming

From: Doug Schepers <doug.schepers@vectoreal.com>
Date: Fri, 26 Jan 2007 18:08:40 -0500
Message-ID: <45BA89F8.5040801@vectoreal.com>
To: Web APIs WG <public-webapi@w3.org>

Hi, Simon-

Simon Pieters wrote:
> A way to reduce the number of typos might be to drop the trailing "s" 
> from both method names. It's equally clear what it does IMHO.

Hmmm... that's a reasonable point, but "Selector" (singular) is a bit 
misleading.  You can provide multiple criteria.

> Of the two getElementListBySelector and getElementsBySelector, the 
> people I've spoken to seem to prefer getElementsBySelector.

Look at this:

var el = document.getElementBySelector(...);
///blah blah more code
var el = document.getElementsBySelector(...);

Imagine debugging that.  A single "s" would not be distinctive enough, IMO.

> Although if API consistency is desireable then "getElementListBy..." 
> doesn't seem to appear anywhere as far as I can tell.

Right, that was by design.  It's not about some sacrosanct magic word, 
but about a naming scheme... we considered NodeList instead, but didn't 
want people to think that it's a list of nodes (it's only elements), nor 
that it's live.  Thus, the distinction.

Received on Friday, 26 January 2007 23:08:51 UTC

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