Opened 11 years ago

Last modified 11 years ago

#11372 closed enhancement

dojo.addClass causes performance problems in IE6 and 7 by assigning identical CSS class — at Version 1

Reported by: Shane O'Sullivan Owned by: anonymous
Priority: high Milestone: 1.5
Component: Core Version: 1.5.0b2
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by Shane O'Sullivan)

When dojo.addClass is called, and the resulting class string is identical to the class already on the node, it still modifies the class.

This causes severe performance issues in IE6 and 7, which I presume comes from forcing a redraw.

dojo.removeClass does not do this, and uses

if(node[_className] != cls){ node[_className] = cls; }

dojo.addClass should also do this. Performance tests have shown, when creating a TabContainer?, the average time for each dojo.addClass call goes from 14ms to 10ms, a huge saving

Instantiating a TabContainer? with many (> 30) tabs in IE 6 and 7 is very slow, and this one line fix speeds it up a lot.

Change History (2)

comment:1 Changed 11 years ago by Shane O'Sullivan

Description: modified (diff)

Changed 11 years ago by Shane O'Sullivan

Attachment: dojo.addClass.patch added

Fix for this issue

Note: See TracTickets for help on using tickets.