Deprecate .toggle( handler, handler, ... ) signature
|Reported by:||gibson042||Owned by:|
Did you know we have two .toggles? The one we like performs .show or .hide as appropriate, and is documented at http://api.jquery.com/toggle/. The other sets up round-robin .click handlers, and is documented at http://api.jquery.com/toggle-event/:
The .toggle() method is provided for convenience. It is relatively straightforward to implement the same behavior by hand, and this can be necessary if the assumptions built into .toggle() prove limiting. For example, .toggle() is not guaranteed to work correctly if applied twice to the same element. Since .toggle() internally uses a click handler to do its work, we must unbind click to remove a behavior attached with .toggle(), so other click handlers can be caught in the crossfire. The implementation also calls .preventDefault() on the event, so links will not be followed and buttons will not be clicked if .toggle() has been called on the element.
Let's put it out of our misery.
Change History (8)
comment:3 Changed 5 years ago by dmethvin
- Component changed from unfiled to event
- Milestone changed from None to 1.8
- Priority changed from undecided to low
- Resolution set to fixed
- Status changed from new to closed