Bug Tracker

Opened 2 years ago

Closed 2 years ago

Last modified 23 months 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 2 years ago by timmywil

  • Component changed from unfiled to attributes
  • Milestone changed from None to 1.10.3/2.0.4
  • Priority changed from undecided to low
  • Status changed from new to open

Seems like a good idea.

comment:3 Changed 2 years ago by dmethvin

  • Resolution set to fixed
  • Status changed from open to closed

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

Changeset: c418b94eb48188cd9329519ae5e030a52dd81cc9

comment:4 Changed 2 years ago by dmethvin

  • Milestone changed from 1.10.3/2.0.4 to 1.11/2.1

Bulk update for new milestone

comment:5 Changed 2 years ago by martinsrosa@…

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 23 months ago by dmethvin

Note: See TracTickets for help on using tickets.