I re-ran the test now.
test('#content a.submit');
test('a.submit');
test('.submit');
test('("#content").find("a.submit")');
Basically I get the same result: for my pages (!) element.MyClass has
the best average performance.
I guess it's as Karl mentioned earlier: "If the selectors aren't
causin
@Karl: o, that was a serious c&p "bug"... :) I was aware that IE6
and 7 don't support getElementsByClassName (see my initial message),
still the results of my first test showed similar results for the
class selector. I hope I didn't have another c&p bug in there... ;)
@Mike: the pages I'm wor
You can't measure whether one selector will be faster than another on all
possible pages. All you can measure is which is faster on the page you're
testing.
On a page with only a single element, an 'a.submit' or even just an 'a'
selector will be faster than '#content a.submit', because it's doin
If you're doing this:
test('#content a.submit');
then you shouldn't compare it to this:
test('("#myDiv").find("span.myClass")');
that's "apples to oranges." instead, compare it to this:
test('("#content").find("a.submit")');
The reason the other browsers are so much faster than IE 6 and 7wit
Hi Karl,
thanks for your reply.
I used jQuery tester in FF2 + 3, IE6, 7 + 8, Opera 9.64 and I think
also in Safari 4 (on my Win XP machine). The results were are all
kinda similar. Using the class selector was always fastest.
I just ran the following test (choosing jQuery 1.3.2 again):
test('#
On Jul 2, 2009, at 8:45 AM, north wrote:
Hi,
I just tested all my jQuery selectors using the jQuery Tester (http://
jquery.nodnod.net), and the results seem to "contradict" one thing I
read in a performance article: that you should descend from the
closest parent ID when using classes in you
6 matches
Mail list logo