Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#14250 closed bug (fixed)

addClass and removeClass needlessly assign to className.

Reported by: jdunck Owned by:
Priority: low Milestone: 1.11/2.1
Component: attributes Version: 2.0.3
Keywords: Cc:
Blocked by: Blocking:


Assigning to className, even with the same value, triggers a re-render in some browsers. This can cause a noticeable render delay on mobile. On causes.com with a $(body).addClass applying an existing class, it took 200ms to render.

I'm not sure how to show this in jsfiddle.

Change History (6)

comment:2 Changed 9 years ago by timmywil

Component: unfiledattributes
Milestone: None1.10.3/2.0.4
Priority: undecidedlow
Status: newopen

Seems like a good idea.

comment:3 Changed 9 years ago by dmethvin

Resolution: fixed
Status: openclosed

Fix #14164: assign className in addClass/removeClass only if changed. Close gh-1331.

Changeset: c418b94eb48188cd9329519ae5e030a52dd81cc9

comment:4 Changed 9 years ago by dmethvin

Milestone: 1.10.3/

Bulk update for new milestone

comment:5 Changed 9 years ago by [email protected]

Thanks a lot. I have a really heavy website layout which I use lots of animations changing classes and I noticed a great improvement using jQuery 1.11 Beta 3 on it. Before and after the version.

comment:6 Changed 9 years ago by dmethvin

Note: See TracTickets for help on using tickets.