- From: Martijn <martijn.martijn@gmail.com>
- Date: Sun, 28 Jan 2007 00:03:35 +0100
- To: "Anne van Kesteren" <annevk@opera.com>
- Cc: "David Håsäther" <hasather@gmail.com>, public-webapi@w3.org
On 1/27/07, Anne van Kesteren <annevk@opera.com> wrote: > > On Thu, 25 Jan 2007 15:04:52 -0500, David Håsäther <hasather@gmail.com> > 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. I don't see any difference:. document.getElementBySelector("html > p") is the same as document.getElementListBySelector("html > p")[0] document.getElementBySelector("html > p:not(:first-child)") is the same as document.getElementListBySelector("html > p:not(:first-child)")[0] document.getElementBySelector("html > p:last-child") is the same as document.getElementListBySelector("html > p:last-child")[0] as far as I can see. Regards, Martijn
Received on Saturday, 27 January 2007 23:03:44 UTC