Na , Simon Pieters <[EMAIL PROTECTED]> escreveu:
Hi,
On Thu, 25 Jan 2007 19:26:38 +0100, Anne van Kesteren <[EMAIL PROTECTED]>
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.
I too like short names. That's why I write my own wrapper functions. If
you really want to use get, write your own wrapper function, but get
itself is not a descriptive name, and therefore is against w3c guidelines
(me thinks). Following that line of reasoning, the specifications would
start having short name for everything, like instead opf writing
doucment.implementation.createDocument I'd write doc.i.cdoc. A
unexperienced programmer will scratch his head wondering what it means.
The base specification must be descriptive, clear and well structured.
... (and now I started the debate again)... :p
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
Again, this is personal taste. I could say the same for any other name.
Regards,