-
Notifications
You must be signed in to change notification settings - Fork 470
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
Attributes: Restore boolean attribute & false setter treatment from 3.x #540
base: main
Are you sure you want to change the base?
Conversation
if ( jQueryVersionSince( "4.0.0" ) ) { | ||
return name.toLowerCase(); | ||
} | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works in jQuery 3.x because - while boolHooks
being a fallback for boolean attributes if attrHooks[ name ]
didn't exist would not get picked up here - boolHooks
only handle a setter and we're in a getter here. The getter - if the get
attr hook is missing or returns null
- is handled via a call to jQuery.find.attr( elem, name )
which is Sizzle.attr( elem, name )
, that defers to Sizzle.selectors.attrHandle
, exposed to jQuery via jQuery.expr.attrHandle
and that, in turn, is set for boolean attrs by jQuery.
@timmywil I introduced two changes here in a fixup commit:
Let me know what you think. |
Restore & warn against: * boolean attributes set to something different than their lowercase names * boolean attributes queried when set to something different than their lowercase names * non-boolean non-ARIA attributes set to `false` Fixes jquerygh-504 Ref jquery/jquery#5452 Ref jquery/api.jquery.com#1243
Restore & warn against:
false
Fixes gh-504
Ref jquery/jquery#5452
Ref jquery/api.jquery.com#1243