Search and Top Navigation
#6764 closed enhancement (fixed)
Opened December 19, 2010 08:05PM UTC
Closed December 19, 2010 09:53PM UTC
Last modified December 19, 2010 09:53PM UTC
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.
Attachments (0)
Change History (3)
Changed December 19, 2010 08:11PM UTC by comment:1
Changed December 19, 2010 09:53PM UTC by comment:2
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
Changed December 19, 2010 09:53PM UTC by comment:3
type: | bug → enhancement |
---|
Pull request: https://github.com/jquery/jquery-ui/pull/77