Re: Selectors API naming

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.

Regards,
Martijn

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


-- 
Martijn Wargers
Help Mozilla!
http://weblogs.mozillazine.org/qa/
http://www.mozilla.org/contribute/

Received on Wednesday, 20 December 2006 22:02:21 UTC