[jQuery] Re: Selector Optimisation Question

2007-07-26 Thread Alex
There is a plugin that dies speed up the selection of DOM elements a lot: http://jquery.com/plugins/project/fastid This plugin speeds up use of $('#id'). Use of $('#id') may be anywhere between 10 and 40 times slower than using $ (document.getElementById('id')), depending on the browser used. I d

[jQuery] Re: Selector Optimisation Question

2007-07-22 Thread NeilM
Thanks Guys, That has been very helpful. On Jul 12, 4:52 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote: > Yeah, as Klaus mentioned, it is a tiny bit faster if you leave out the > 'img'. > > The real optimization you can do is to avoid using the same selector > repeatedly. In a way, jQuery makes

[jQuery] Re: Selector Optimisation Question

2007-07-12 Thread Michael Geary
Yeah, as Klaus mentioned, it is a tiny bit faster if you leave out the 'img'. The real optimization you can do is to avoid using the same selector repeatedly. In a way, jQuery makes it too easy to write inefficient code: $('#foo').doSomething(); // ...later... $('#foo').doSomethingElse(

[jQuery] Re: Selector Optimisation Question

2007-07-12 Thread Klaus Hartl
NeilM wrote: I have just started to use jQuery in my web development and have a question concerning optimising element selection. I find that I create a lot of references to id'd elements: Then, in my JavaScript, I want to obtain a reference to the element. Now, even though it has an id, I t