It does that by having hide() remember the old element block vs. inline type
in "this.oldblock", and then show() uses that to decide what to do:
hidden.each(function(){
this.style.display = this.oldblock ? this.oldblock : "";
if ( jQuery.css(this,"display") == "none" )
this.style.display = "block";
});
That is an odd little bit of code, but it looks like that is what it's
doing.
I think this would still fall apart in the case where you have an element
that is initially hidden (you never call hide() on it) and then show it. It
won't have this.oldblock to look at in that case.
_____
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Karl Swedberg
Sent: Wednesday, February 14, 2007 3:55 PM
To: jQuery Discussion.
Subject: Re: [jQuery] $.show() improvement
I just tested using .hide() and .show() in Firebug with <a> elements, and
.show() only makes them elem.style.display="block" when there is a speed
designated. Plain .show() returns them to inline.
On Feb 14, 2007, at 5:37 PM, Michael Geary wrote:
The real problem here is that there is *no such thing* as "showing" an HTML
element. All you can do is set it to block or inline. This suggests that
show() is a mistake: you need separate showBlock() and showInline() methods.
I wonder, would it be possible to pass in another argument instead?
Something like .show('slow', 'inline') ? Or would that require too much code
rewriting? Would have to consider the callback function too.
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/