8000 fixup! fixup! Attributes: Support the `until-found` value for the `hi… · jquery/jquery@32391cf · GitHub
[go: up one dir, main page]

Skip to content

Commit 32391cf

Browse files
committed
fixup! fixup! Attributes: Support the until-found value for the hidden attribute
1 parent 1f668bf commit 32391cf

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/attributes/attr.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,19 @@ jQuery.extend( {
106106
// Hooks for boolean attributes
107107
boolHook = {
108108
set: function( elem, value, name ) {
109+
var strValue = String( value );
110+
109111
if ( value === false ) {
110112

111113
// Remove boolean attributes when set to false
112114
jQuery.removeAttr( elem, name );
113-
} else if (
114-
name.toLowerCase() !== "hidden" ||
115-
String( value ).toLowerCase() !== "until-found"
116-
) {
117-
elem.setAttribute( name, name );
118115
} else {
119-
elem.setAttribute( name, value );
116+
elem.setAttribute( name,
117+
name.toLowerCase() === "hidden" &&
118+
strValue.toLowerCase() === "until-found" ?
119+
strValue :
120+
name
121+
);
120122
}
121123
return name;
122124
}
@@ -136,13 +138,10 @@ jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name )
136138
attrHandle[ lowercaseName ] = ret;
137139

138140
ret = getter( elem, name, isXML );
139-
if ( ret != null ) {
140-
if ( lowercaseName !== "hidden" ||
141-
ret.toLowerCase() !== "until-found"
142-
) {
143-
ret = lowercaseName;
144-
}
145-
}
141+
ret = ret == null ||
142+
( lowercaseName === "hidden" && ret.toLowerCase() === "until-found" ) ?
143+
ret :
144+
lowercaseName;
146145

147146
attrHandle[ lowercaseName ] = handle;
148147
}

0 commit comments

Comments
 (0)
0