aboutsummaryrefslogtreecommitdiffstats
path: root/src/css.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/css.js')
-rw-r--r--src/css.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/css.js b/src/css.js
index 57edd1507..744e7a545 100644
--- a/src/css.js
+++ b/src/css.js
@@ -43,8 +43,7 @@ function vendorPropName( style, name ) {
return origName;
}
-function isHidden( elem, el ) {
- elem = el || elem;
+function isHidden( elem ) {
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument.documentElement, elem );
}
@@ -111,16 +110,19 @@ jQuery.fn.extend({
hide: function() {
return showHide( this );
},
- toggle: function( fn, fn2 ) {
- var bool = typeof fn === "boolean";
+ toggle: function( state, fn2 ) {
+ var bool = typeof state === "boolean";
- if ( jQuery.isFunction( fn ) && jQuery.isFunction( fn2 ) ) {
+ if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) {
return eventsToggle.apply( this, arguments );
}
return this.each(function() {
- var state = bool ? fn : jQuery( this ).is(":hidden");
- showHide([ this ], state );
+ if ( bool ? state : isHidden( this ) ) {
+ jQuery( this ).show();
+ } else {
+ jQuery( this ).hide();
+ }
});
}
});