W3C home > Mailing lists > Public > public-webapi@w3.org > January 2007

Re: [selectors api] Why two methods?

From: Martijn <martijn.martijn@gmail.com>
Date: Sun, 28 Jan 2007 00:17:37 +0100
Message-ID: <6c97b8b10701271517tb44b484s7c2f2679c2b84c64@mail.gmail.com>
To: "Anne van Kesteren" <annevk@opera.com>
Cc: "David Håsäther" <hasather@gmail.com>, public-webapi@w3.org

On 1/28/07, Anne van Kesteren <annevk@opera.com> wrote:
> On Sat, 27 Jan 2007 18:03:35 -0500, Martijn <martijn.martijn@gmail.com>
> wrote:
> > 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.
>
> Given that the latter returns a StaticNodeList you can't do fancy stuff
> such as lazy evaluation. So they become different in terms of speed.

Well, typically the first thing I do is using a variable, like:
var x=document.getElementListBySelector("html > p")[0];

Regards,
Martijn
Received on Saturday, 27 January 2007 23:17:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:56 GMT