Re: [selectors api] Why two methods?

2007-01-27 Thread Martijn
On 1/27/07, 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

Re: [selectors api] Why two methods?

2007-01-27 Thread Anne van Kesteren
On Sat, 27 Jan 2007 18:03:35 -0500, Martijn [EMAIL PROTECTED] 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

Re: [selectors api] Why two methods?

2007-01-27 Thread Martijn
On 1/28/07, Anne van Kesteren [EMAIL PROTECTED] wrote: On Sat, 27 Jan 2007 18:03:35 -0500, Martijn [EMAIL PROTECTED] wrote: I don't see any difference:. document.getElementBySelector(html p) is the same as document.getElementListBySelector(html p)[0] document.getElementBySelector(html

Re: [selectors api] Why two methods?

2007-01-27 Thread Bjoern Hoehrmann
* Anne van Kesteren 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

Re: [selectors api] Why two methods?

2007-01-27 Thread Anne van Kesteren
On Sat, 27 Jan 2007 18:17:37 -0500, Martijn [EMAIL PROTECTED] wrote: 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

[selectors api] Why two methods?

2007-01-25 Thread David Håsäther
Why does the Selectors API define two methods for retrieving nodes? I understand that there are speed gains by having a method that grabs just the first node, but how often do you want to do that? Don't you want to grab the second node as often? Or the last? -- David Håsäther

Re: [selectors api] Why two methods?

2007-01-25 Thread Anne van Kesteren
On Thu, 25 Jan 2007 14:39:46 -0500, David Håsäther [EMAIL PROTECTED] wrote: Why does the Selectors API define two methods for retrieving nodes? I understand that there are speed gains by having a method that grabs just the first node, but how often do you want to do that? Don't you want to

Re: [selectors api] Why two methods?

2007-01-25 Thread David Håsäther
On 2007-01-25 20:42, Anne van Kesteren wrote: On Thu, 25 Jan 2007 14:39:46 -0500, David Håsäther [EMAIL PROTECTED] wrote: Why does the Selectors API define two methods for retrieving nodes? I understand that there are speed gains by having a method that grabs just the first node, but how

Re: [selectors api] Why two methods?

2007-01-25 Thread David Håsäther
On 2007-01-25 20:53, Anne van Kesteren wrote: On Thu, 25 Jan 2007 14:48:35 -0500, David Håsäther [EMAIL PROTECTED] wrote: What I mean is, why does grabbing the first node deserve its own method? Is that really a common thing to do, grabbing the first node? More common than grabbing the second