#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: |
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 (6)
comment:1 Changed 8 years ago by
comment:2 Changed 8 years ago by
Component: | unfiled → attributes |
---|---|
Milestone: | None → 1.10.3/2.0.4 |
Priority: | undecided → low |
Status: | new → open |
Seems like a good idea.
comment:3 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Fix #14164: assign className in addClass/removeClass only if changed. Close gh-1331.
Changeset: c418b94eb48188cd9329519ae5e030a52dd81cc9
comment:5 Changed 7 years ago by
comment:6 Changed 7 years ago by
Ref https://code.google.com/p/chromium/issues/detail?id=278045 which has supposedly been fixed.
Note: See
TracTickets for help on using
tickets.
Per https://github.com/jquery/jquery/pull/1331#issuecomment-22469431 , this fits under the layout reflows umbrella: http://bugs.jquery.com/ticket/14164