I poked around even more to see if there could be anythings improved.
I added tests for querySelectorAll, Xpath and native
nextSiblingElement (if present).
Alas, with qsa is quite tricky to simulate siblings -- I had to set
and unset attributes to achieve it and to use [] and :not selectors.
XP
`adHocSiblings` is clearly faster. I guess since it avoids 2 extra
function calls (`previousSiblings` and `nextSiblings`).
Running a simple test based on your example page:
var tdEl = document.getElementsByTagName('td')[100];
var t = new Date();
for (var i=1000; i--; ) protoSiblings(tdEl);
var
Actually I did make a test case --
http://groups.google.com/group/prototype-core/web/element%23siblings.zip --
zipped to take less space from the quota.
For fair tests, I extracted the methods as simple functions.
Note:
* The first click is noticably slower then the rest of the clicks.
* Actual e
On Sep 2, 6:25 pm, joneff wrote:
> (It's kinda long and it might be for the other prototype group, but I
> am not sure.)
>
> I was poking around with a script for manipulating tables which takes
> heavy use of Element#siblings for some of the manips.
>
> And I found that in some cases it [the met