On Sat, 27 Jan 2007 23:54:33 +0100, Anne van Kesteren <[EMAIL PROTECTED]>
wrote:
On Thu, 25 Jan 2007 15:04:52 -0500, David Håsäther <[EMAIL PROTECTED]>
wrote:
Yes, but grabbing the first node has its own method. Grabbing the
second or last does not. What I don't understand is _why_ there is a
special method for grabbing the first node? I just don't think that is
a common thing to do, and as Jim said, those nodes usually have an id.
It's not about getting the first node, as demonstrated. It's about
getting a single node.
So what are the use-cases for getting a single node?
Let's see.
Get the root element? Nope, there's document.documentElement for that.
Get the HTML body element? Nope, there's document.body for that.
Get a form control in HTML? Nope, there's document.forms[0].foo for that,
or if the form controls happens to have an id then getElementById() can be
used.
I can't come up with other common use-cases, but of course this was only
off the top of my head; if there are sensible use-cases and the
performance differences are worth mentioning then it might be better to
keep the method. But for the use-cases I could come up with for now there
are other methods that already work and are pretty much as convenient to
use.
Regards,
--
Simon Pieters