10000 Attributes: Support the `until-found` value for the `hidden` attribute by mgol · Pull Request #5607 · jquery/jquery · GitHub
[go: up one dir, main page]

Skip to content

Attributes: Support the until-found value for the hidden attribute #5607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 16, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! Attributes: Support the until-found value for the hidden a…
…ttribute
  • Loading branch information
mgol committed Jan 16, 2025
commit 6ac7a97b5ddaad2e8c7efbf9d7aeaebb14913b8a
16 changes: 5 additions & 11 deletions src/attributes/attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ define( [
"use strict";

var boolHook,
attrHandle = jQuery.expr.attrHandle,

// Some formerly boolean attributes gained new values with special meaning.
// Skip the old boolean attr logic for those values.
extraBoolAttrValues = {
hidden: [ "until-found" ]
};
attrHandle = jQuery.expr.attrHandle;

jQuery.fn.extend( {
attr: function( name, value ) {
Expand Down Expand Up @@ -117,8 +111,8 @@ boolHook = {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else if (
( extraBoolAttrValues[ name.toLowerCase() ] || [] )
.indexOf( String( value ).toLowerCase() ) === -1
name.toLowerCase() !== "hidden" ||
String( value ).toLowerCase() !== "until-found"
) {
elem.setAttribute( name, name );
} else {
Expand All @@ -143,8 +137,8 @@ jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name )

ret = getter( elem, name, isXML );
if ( ret != null ) {
if ( ( extraBoolAttrValues[ lowercaseName ] || [] )
.indexOf( ret.toLowerCase() ) === -1
if ( lowercaseName !== "hidden" ||
ret.toLowerCase() !== "until-found"
) {
ret = lowercaseName;
}
Expand Down
0