Bug Tracker

Ticket #14250 (closed bug: fixed)

Opened 13 months ago

Last modified 7 months ago

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:
Blocking: Blocked by:

Description

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

comment:2 Changed 13 months ago by timmywil

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

Seems like a good idea.

comment:3 Changed 13 months ago by dmethvin

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

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

Changeset: c418b94eb48188cd9329519ae5e030a52dd81cc9

comment:4 Changed 12 months 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 8 months 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 7 months ago by dmethvin

Note: See TracTickets for help on using tickets.