Side navigation
#5343 closed bug (duplicate)
Opened October 09, 2009 04:54AM UTC
Closed October 27, 2010 10:34PM UTC
Last modified October 27, 2010 10:34PM UTC
bugs in show/hide
Reported by: | markw65 | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | effects | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I see this code in the hide() function in fx.js:
var old = jQuery.data(this[i], "olddisplay");
if ( !old && old !== "none" )
jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
This makes no sense to me, given how the "olddisplay" data is used. In particular, note that '&& old !== "none"' is redundant, since its a sure thing if !old is true (!)
I think the above should be:
var old = jQuery.css(this[i], "display");
if ( old && old !== "none" )
jQuery.data(this[i], "olddisplay", old);
The existing code causes a rather nasty issue when hiding and showing tr elements if you have a plugin on the page in FF3.5
see http://maps.myosotissp.com/bugs/show_hide.html
Click the "Show TR" button. Calls show() on a tr element that has been previously hidden. Because of the above bug, it resorts to setting up "elemdisplay" for a tr, and FF doesnt seem to like removing a tr thats been appended to the body element.
I may be missing something, but it looks to me like the "elemdisplay" code should never be used - and is only "needed" because of the bug in hide().
jQuery.data(this[i], "olddisplay"); is used to store the display value before a show or hide call was called on it. It lets jquery try to restore this value later. This wasn't working as well as it could be in older versions of jQuery but I have done some work with it in 1.4 to make it work better in the cases like table cells and inline elements.