aboutsummaryrefslogtreecommitdiffstats
path: root/src/attributes/attr.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/attributes/attr.js')
-rw-r--r--src/attributes/attr.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/attributes/attr.js b/src/attributes/attr.js
index ddddcada6..5a911c7d0 100644
--- a/src/attributes/attr.js
+++ b/src/attributes/attr.js
@@ -97,7 +97,15 @@ if ( isIE ) {
};
}
-jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
+// HTML boolean attributes have special behavior:
+// we consider the lowercase name to be the only valid value, so
+// getting (if the attribute is present) normalizes to that, as does
+// setting to any non-`false` value (and setting to `false` removes the attribute).
+// See https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes
+jQuery.each( (
+ "checked selected async autofocus autoplay controls defer disabled " +
+ "hidden ismap loop multiple open readonly required scoped"
+).split( " " ), function( _i, name ) {
jQuery.attrHooks[ name ] = {
get: function( elem ) {
var ret,