Hi,

To improve efficiency, try using contexts in order to restrict the
parsed DOM elements.

For example, if you know that all targeted elements are in <div
id="main"> ..... stuff .... <p class="myclass"> .. target text...</
p> ..... </div> then you should guide the selector engine towards the
target : $('#main .myclass <your custom selectors>'). Another synataxe
is : $(<myselector>, <jQuery node as context>) and finally : $
(<context selector>).find(<myselector>)...

Try avoiding "absolute" selectors like : $('a').doSomethingCool();

Good luck,

Cameron.

On 9 déc, 17:02, "T.J." <theimmortal...@gmail.com> wrote:
> I just ran a page with an absurd amount of inputs through the Firebug
> profiler and it seems that the majority of the time spent running
> scripts is inside jQuery's (I'm using 1.4a1) Sizzle selector, which
> makes me think I'm inefficiently using selectors (which I can almost
> guarantee is the case).
>
> Again,
> thanks.
>
> T.J.
>
> On Dec 9, 9:43 am, "T.J." <theimmortal...@gmail.com> wrote:
>
>
>
> > Hi all,
>
> > I wrote a suggestion plugin to make suggestions as the user types, and
> > display a tooltip if they mouse over the suggestion. This is my first
> > jQuery plugin and I followed the design/layout posted by Mike Alsup on
> > learningjquery.com
>
> > However, as I don't have too much experience with this.. I think I did
> > something wrong here. Pages become nigh unusable if there's a high
> > number of inputs on the page, and I think it's because of the plugin.
> > I'm not entirely sure where to post the code for the plugin as
> > jsbin.com seems to truncate it just a bit.
>
> > What I'm needing is any suggestions on how to improve the performance
> > of it. If anyone has any ideas of where I could place the file, please
> > let me know.
>
> > Thank you.
> > T.J.

Reply via email to