On 29 avr, 14:55, Dave Methvin <[EMAIL PROTECTED]> wrote: > > > > I have this piece of code that works fine, but is a bit slow (on a > > > > page with =~ 25 container and =~ 70 buttons, it takes about 2 to 3 > > > > seconds to complete, even after I made my best to narrow down the $ > > > > (elt) set on which it is called). So I if anybody here has any idea to > > > > improve it... > > > > Is it the setup, or is the 2-3 > > > seconds when you click on something? > > > Sorry, forgot to mention this. And yes, it's the setup that's taking > > too long. > > > Now most of the time is spent into curCSS() and data()... > > What do your selectors look like that are used there? Here are the > three I would like to know for sure: > > * number of elements OneOfTogglers() is applied to
If you mean the number of elements in the $(something) I call OneOfTogglers on, it vary depending on the user (it's a igoogle-like page), but is in the order of 10/20 elements. The page on which I made these tests has 14 such elements. > * containerSelector ul.toglist - 24 such elements on the page (some blocks have up to 6 ul.toglist elements) > * buttonSelector a.togbutton - actually 71 of them on this page. FWIW, the page is a bit heavy on markup (document.getElementsByTagName('*') on my current test page yields 1295), but this is not something I can help.