Opened 10 years ago

Closed 10 years ago

#11372 closed enhancement (fixed)

dojo.addClass causes performance problems in IE6 and 7 by assigning identical CSS class

Reported by: Shane O'Sullivan Owned by: Eugene Lazutkin
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.

Attachments (1)

dojo.addClass.patch (421 bytes) - added by Shane O'Sullivan 10 years ago.
Fix for this issue

Download all attachments as: .zip

Change History (4)

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

Description: modified (diff)

Changed 10 years ago by Shane O'Sullivan

Attachment: dojo.addClass.patch added

Fix for this issue

comment:2 Changed 10 years ago by Eugene Lazutkin

Owner: changed from anonymous to Eugene Lazutkin
Priority: highnormal
severity: majorminor
Status: newassigned

comment:3 Changed 10 years ago by Eugene Lazutkin

Resolution: fixed
Status: assignedclosed
Type: defectenhancement

Robot missed: (In [22383]) Performance improvement for dojo.addClass(), thx shaneosullivan!, !strict, fixes #11372.

Note: See TracTickets for help on using tickets.