-
Notifications
You must be signed in to change notification settings - Fork 20.6k
Selector: Make selector.js
module depend on attributes/attr.js
#5384
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
Conversation
selector.js
module depend on attributes/attr.js
The size report for this is pretty surprising...
I could use some gzip magic from @gibson042 here. 😉 |
91fa203
to
2a54f5d
Compare
After the latest changes:
|
36c55f1
to
f192303
Compare
This fixes custom builds using the `--include` switch that don't include the `attributes` module. Fixes jquerygh-5379
f192303
to
d7557b0
Compare
OK, without the addition of a dependency on
so it looks this part is to blame. |
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.
LGTM
jQuery.each( ( | ||
"checked selected async autofocus autoplay controls defer disabled " + | ||
"hidden ismap loop multiple open readonly required scoped" | ||
).split( " " ), function( _i, name ) { |
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.
jQuery.each( ( | |
"checked selected async autofocus autoplay controls defer disabled " + | |
"hidden ismap loop multiple open readonly required scoped" | |
).split( " " ), 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 ) { |
Note also that our list is outdated; it is missing several boolean attributes from HTML Attributes, includes a scoped
that isn't even present there, and treats hidden
as boolean despite the expansion of that attribute to be an enumeration including "until-found" by whatwg/html@f5def65 .
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.
Oh, interesting. Perhaps we should update this list for 4.0 as this can be considered a breaking change.
Or we should get rid of this manual normalization, depending on users doing the right thing here. The biggest issue are possibly falsy checks on values since an empty string is also a valid value. If we're worried about compat for such things, my guess would be we could limit this list to just a few entries like checked
& selected
. Thoughts, @timmywil @gibson042?
EDIT: extracted to #5388, let's discuss this issue there
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.
I extracted the issue about the list itself into #5388; let's limit this PR to just the issue at hand and keep the list the same here.
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
In jquery/jquery#5384, `jQuery.expr.match.bool` stopped being defined and the regex matching boolean attributes is no longer exposed. Inline it in Migrate to avoid it crashing on jQuery 4.x. Fixes jquerygh-495
In jquery/jquery#5384, `jQuery.expr.match.bool` stopped being defined and the regex matching boolean attributes is no longer exposed. Inline it in Migrate to avoid it crashing on jQuery 4.x. Fixes gh-495 Closes gh-496
Summary
This fixes custom builds using the
--include
switch that don't include theattributes
module.Note: as of this change,
jQuery.expr.match.bool
is no longer defined.Fixes gh-5379
Checklist