#6764 closed enhancement (fixed)
Use toggleClass instead of [ bool ? "addClass" : "removeClass" ]
Reported by: | Xavi | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.0 |
Component: | [meta] ui.dev | Version: | 1.8.7 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Several times in the jquery-ui code base a class is conditionally added to an element using this construct: elem[ bool ? "addClass" : "removeClass" ]("foo")
. I propose that `$.fn.toggleClass` be used instead. I feel this change will make the code less verbose and easier to read.
Change History (3)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
All: Use .toggleClass() instead of conditionally using .addClass() and .removeClass(). Fixes #6764 - Use toggleClass instead of [ bool ? 'addClass' : 'removeClass' ].
Changeset: 956697bfca1b386ae20eb27ccfd8c1df3234f1f2
comment:3 Changed 13 years ago by
Type: | bug → enhancement |
---|
Note: See
TracTickets for help on using
tickets.
Pull request: https://github.com/jquery/jquery-ui/pull/77