Description
Visting very large pages with IE causes the browser to hang / to freeze for quite some time (>>10 seconds).
Describe the bug...
Steps to reproduce
Visit e.g. MoinAPI/Beispiele with IE7 or IE6
- Look what's happening: Although the page has been loaded, the browser hangs for quite some time.
- If the page has inline comments: click "Comments". The browser hangs again for quite some time.
Example
Component selection
- common.js?? (toggleComments()?? show_toggleComments()??)
Details
This wiki
Workaround
Discussion
Turning off Javascript speeds it up quite a lot. The browser doesn't hang anymore. I could not reproduce this behaviour on FF3 and Opera9.52 but I think I have seen some similar behaviour on FF2 (but I am not sure).
If you use a Javascript profiler (e.g Venkman) you will see that both functions (toggleComments, show_toggleComments) take quite a lot of time (compared to the other stuff). Instead of parsing all elements of the DOM-tree with
document.getElementsByTagName('*'); ... if ( el.className.indexOf('comment') >= 0 ){ ...
it would be more efficient to search more specifically (and thus maybe much faster) with
var elements = document.getElementsByName("inline_comment"); for (j=0; j < elements.length; j++) { ...
But this is not tested.
How about testing it? Note that your code is not equivalent to the one you want to replace. I usually don't have a windows machine available when developping. -- ThomasWaldmann 2008-09-22 18:42:43
Ok. I have now tested it. The proposed solution worked nicely and fast on Firefox and Opera, but not on IE. Reason: IE does not recognize name-attribs when given to span/div elements. Giving names to span/div elements is also not valid html. So there seems to be no cure for the described problem above.
see /ReferenceTime for some tests
Plan
- Priority:
- Assigned to:
Status: I don't think this is a moin bug, it is just a crap slow IE browser. Speed up for IE by: http://hg.moinmo.in/moin/1.8/rev/5c88b27f31e5 - thanks to the nice and speedy getElementsByClassName implementation.