Skip to main content

Bug Tracker

Side navigation

#14250 closed bug (fixed)

Opened August 12, 2013 03:09AM UTC

Closed August 19, 2013 04:21PM UTC

Last modified January 24, 2014 05:27PM UTC

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 with a $(body).addClass applying an existing class, it took 200ms to render.

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

Attachments (0)
Change History (6)

Changed August 12, 2013 03:15AM UTC by jdunck comment:1

Changed August 13, 2013 02:01PM UTC by timmywil comment:2

component: unfiledattributes
milestone: None1.10.3/2.0.4
priority: undecidedlow
status: newopen

Seems like a good idea.

Changed August 19, 2013 04:21PM UTC by dmethvin comment:3

resolution: → fixed
status: openclosed

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

Changeset: c418b94eb48188cd9329519ae5e030a52dd81cc9

Changed September 16, 2013 01:21AM UTC by dmethvin comment:4

milestone: 1.10.3/

Bulk update for new milestone

Changed December 28, 2013 08:43PM UTC by comment:5

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.

Changed January 24, 2014 05:27PM UTC by dmethvin comment:6

Ref which has supposedly been fixed.