Modify ↓
Ticket #11883 (closed bug: invalid)
Possible bug in toggleClass
| Reported by: | troels@… | Owned by: | troels@… |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | css | Version: | 1.7.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Not sure if it's a bug or not, but it seems there's an issue with class order in the toggleClass function.
The function only works for me when the toggled class is loaded after the original class in the css.
Is that on purpose?
I've tried most recent version of jQuery.
P.S. I'm otherwise more than satisfied with jQuery. Great job guys!!
Change History
comment:1 Changed 12 months ago by sindresorhus
- Owner set to troels@…
- Status changed from new to pending
comment:2 Changed 12 months ago by troels@…
- Status changed from pending to new
Take a look at this example:
comment:3 Changed 12 months ago by sindresorhus
- Priority changed from undecided to low
- Resolution set to invalid
- Status changed from new to closed
- Component changed from unfiled to css
If you inspect your HTML you can clearly see that the correct classes are applied. This is a problem with CSS specificity and not jQuery.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.
Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.