Changing the className property in IE7 is extremely slow

On my website, I dynamically change the javascript 'className' DIV property. However, this is an extremely expensive operation, since the DIV contains many child nodes. Sometimes it takes up to 1.5 seconds.

Is there any way to speed up this operation? For example, hiding the contents, performing the operation, and then again showing the contents?

Update:

Additional Information.

Actual code:

$("#myDiv").tabs();

It is located in the .ready () handler. See http://jqueryui.com/demos/tabs/

This is an expensive call. I tracked it down to the className property , which consumes all the processing time.

The DIV contains a large sharepoint data file, see http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spview.renderashtml.aspx Code runs on Sharepoint, tested on WinXP + IE7.

So I'm wondering if we can turn off layout updates when manipulating the DOM or something like that. Are there any tricks?

+5
source share
2 answers

, CSS, , , , , . , , , - , div.whatever td.currency, , , td.currency ( ).

IE , , (, , ) . , IE8 .

+3

All Articles