mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Avoid jQuery(this) and a closure for .toggle(Boolean), close gh-1271.
(cherry picked from commit e53a919090)
This commit is contained in:
committed by
Dave Methvin
parent
adf3090318
commit
9a3683b110
@@ -134,10 +134,12 @@ jQuery.fn.extend({
|
||||
return showHide( this );
|
||||
},
|
||||
toggle: function( state ) {
|
||||
var bool = typeof state === "boolean";
|
||||
if ( typeof state === "boolean" ) {
|
||||
return state ? this.show() : this.hide();
|
||||
}
|
||||
|
||||
return this.each(function() {
|
||||
if ( bool ? state : isHidden( this ) ) {
|
||||
if ( isHidden( this ) ) {
|
||||
jQuery( this ).show();
|
||||
} else {
|
||||
jQuery( this ).hide();
|
||||
|
||||
Reference in New Issue
Block a user