mirror of
https://github.com/jquery/jquery.git
synced 2026-02-01 01:36:16 -05:00
CSS: Make show/hide/toggle methods a module
Unit test changes some uses of .show() and .hide() to .css( "display", ... ), there was already an implicit assumption in several of the existing tests. Fixes gh-2193 Close gh-2648
This commit is contained in:
committed by
Timmy Willison
parent
e271f665dd
commit
67d7a2eefe
22
src/css.js
22
src/css.js
@@ -14,13 +14,12 @@ define( [
|
||||
"./css/adjustCSS",
|
||||
"./css/addGetHookIf",
|
||||
"./css/support",
|
||||
"./css/showHide",
|
||||
|
||||
"./core/init",
|
||||
"./core/ready",
|
||||
"./selector" // contains
|
||||
], function( jQuery, pnum, access, rmargin, document, rcssNum, rnumnonpx, cssExpand,
|
||||
isHidden, getStyles, swap, curCSS, adjustCSS, addGetHookIf, support, showHide ) {
|
||||
isHidden, getStyles, swap, curCSS, adjustCSS, addGetHookIf, support ) {
|
||||
|
||||
var
|
||||
|
||||
@@ -401,25 +400,6 @@ jQuery.fn.extend( {
|
||||
jQuery.style( elem, name, value ) :
|
||||
jQuery.css( elem, name );
|
||||
}, name, value, arguments.length > 1 );
|
||||
},
|
||||
show: function() {
|
||||
return showHide( this, true );
|
||||
},
|
||||
hide: function() {
|
||||
return showHide( this );
|
||||
},
|
||||
toggle: function( state ) {
|
||||
if ( typeof state === "boolean" ) {
|
||||
return state ? this.show() : this.hide();
|
||||
}
|
||||
|
||||
return this.each( function() {
|
||||
if ( isHidden( this ) ) {
|
||||
jQuery( this ).show();
|
||||
} else {
|
||||
jQuery( this ).hide();
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user