W3C home > Mailing lists > Public > public-webapi@w3.org > December 2006

Re: Selectors API naming

From: Martijn <martijn.martijn@gmail.com>
Date: Wed, 20 Dec 2006 22:55:11 +0100
Message-ID: <6c97b8b10612201355s4c60b120v6eac8265e1864045@mail.gmail.com>
To: "Robert Sayre" <sayrer@gmail.com>
Cc: "Jim Ley" <jim@jibbering.com>, "Chris Wilson" <Chris.Wilson@microsoft.com>, "Ian Hickson" <ian@hixie.ch>, "Dave Massy" <dave.massy@microsoft.com>, "Anne van Kesteren" <annevk@opera.com>, "Web API WG (public)" <public-webapi@w3.org>

On 12/20/06, Robert Sayre <sayrer@gmail.com> wrote:
> On 12/20/06, Martijn <martijn.martijn@gmail.com> wrote:
> >
> > So would thes popular JS libraries stop using those names if
> > document.getElementById was called document.id for example?
> Who can say?

I can't say, but I don't think they would stop.

> > > I guess that's the nice thing about getElementsBySelector. It's like
> > > picking 6 names all at once. :)
> >
> > I don't think getElementsBySelector is picking 6 names at once at all.
> I've been doing experimental implementations of
> document.getElementsBy* methods and I'm willing to guarantee that it
> is effectively picking many names. I can't even remember the ones I'm
> working on. The problem is that it requires JavaScript programmers to
> type 22 characters before encountering characters that uniquely
> identify it, and 19 characters before it's clear that the method will
> return a NodeList. The JS library authors of the world seem to
> understand this argument.

Typing 7 character is indeed shorter than typing 22 characters, so
yes, I would prefer to type 7 characters.
But I think it's more important to have a function name that makes it
more or less clear what it is doing and that's consistent with
existing function names.

> If XPath can use "evaluate"[1], I don't see what's wrong with
> "matchSingle/matchAll".

Well, I don't really like that name either.


> --
> Robert Sayre
> [1] <http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathEvaluator-evaluate>

Martijn Wargers
Help Mozilla!
Received on Wednesday, 20 December 2006 22:02:21 UTC

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