Opened 8 years ago
Closed 8 years ago
#14848 closed bug (fixed)
on at least some form elements .hide(0) acts as a toggle instead of simply hiding
Reported by: | Owned by: | gibson042 | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.11.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If .hide() is applied with duration 0 (I haven't actually tried other values yet), either as a single argument or an object {duration: 0}, to some elements within a form (at least the label & radio buttons will work this way), it acts as a toggle instead of just hiding the element regardless of its former state.
Without arguments, it behaves correctly.
If you switch to jQuery-1.10.2, it behaves as expected.
It seems to (mis)behave the same in Firefox & Chrome. I don't know about IE yet.
http://jsfiddle.net/KarMannJRO/YTGvH/
Click the "hide it" button repeatedly. The <p> element disappears, and stays hidden; the label & associated input toggle between hidden & shown.
Change History (5)
comment:1 Changed 8 years ago by
comment:2 Changed 8 years ago by
Biggest, less reduced case shows that it affects all type of input elements (except hidden, I suppose) and textareas & labels alike.
comment:3 Changed 8 years ago by
Owner: | set to gibson042 |
---|---|
Status: | new → assigned |
comment:4 Changed 8 years ago by
Also, I've tried it with other values for duration, and it looks like it doesn't matter what the value is, just that it's specified. Also, the showing is always instant regardless of duration value. Handy test cases here: http://jsfiddle.net/KarMannJRO/YTGvH/6/
comment:5 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Effects: Don't overwrite display:none when .hide()ing hidden elements
Fixes #14848 Closes gh-1548
Changeset: 890d441aa5d319e49951ba6f0ec719cd4cb96759
Also, for a slightly more reduced case, it works similarly if you remove the label element but leave the input, and update the JS .hide() line appropriately, except that then it's only the button itself that toggles, of course, and the text remains shown throughout.
http://jsfiddle.net/KarMannJRO/YTGvH/3/