Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Selector: Makeselector.js module depend onattributes/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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mgol merged 2 commits intojquery:mainfrommgol:selector-attr-dependency
Jan 12, 2024

Conversation

mgol
Copy link
Member

@mgolmgol commentedJan 4, 2024
edited
Loading

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.

Fixesgh-5379

Checklist

@mgolmgol added Selector Needs review Discuss in MeetingReserved for Issues and PRs that anyone would like to discuss in the weekly meeting. labelsJan 4, 2024
@mgolmgol self-assigned thisJan 4, 2024
@mgolmgol changed the titleSelector: Eliminate selector.js depenencies from various modulesSelector: Makeselector.js module depend onattributes/attr.jsJan 4, 2024
@mgol
Copy link
MemberAuthor

mgol commentedJan 4, 2024

The size report for this is pretty surprising...

main @e8b7db4b0f1e1b8e08578641b30a92b955ccc4ec   raw     gz Filename   -51    +51 dist/jquery.min.js   -47     +8 dist/jquery.slim.min.js   -51    +51 dist-module/jquery.module.min.js   -47    +10 dist-module/jquery.slim.module.min.js

I could use some gzip magic from@gibson042 here. 😉

@mgolmgolforce-pushed theselector-attr-dependency branch from91fa203 to2a54f5dCompareJanuary 4, 2024 00:35
@mgol
Copy link
MemberAuthor

mgol commentedJan 4, 2024

After the latest changes:

main @e8b7db4b0f1e1b8e08578641b30a92b955ccc4ec   raw     gz Filename   -68    +37 dist/jquery.min.js   -64    -10 dist/jquery.slim.min.js   -68    +37 dist-module/jquery.module.min.js   -64     -8 dist-module/jquery.slim.module.min.js

+37 bytes is still significant for something that in theory should remove bytes.

@mgolmgolforce-pushed theselector-attr-dependency branch 2 times, most recently from36c55f1 tof192303CompareJanuary 4, 2024 10:50
This fixes custom builds using the `--include` switch that don't includethe `attributes` module.Fixesjquerygh-5379
@mgolmgolforce-pushed theselector-attr-dependency branch fromf192303 tod7557b0CompareJanuary 4, 2024 10:52
@mgol
Copy link
MemberAuthor

mgol commentedJan 4, 2024

OK, without the addition of a dependency onattributes/attr.js toselector.js the size difference is as follows:

main @e8b7db4b0f1e1b8e08578641b30a92b955ccc4ec   raw     gz Filename   -51    -13 dist/jquery.min.js   -51    -25 dist/jquery.slim.min.js   -51    -16 dist-module/jquery.module.min.js   -51    -25 dist-module/jquery.slim.module.min.js

so it looks this part is to blame.

Copy link
Member

@timmywiltimmywil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM

@timmywiltimmywil removed the Discuss in MeetingReserved for Issues and PRs that anyone would like to discuss in the weekly meeting. labelJan 8, 2024
Comment on lines +100 to +103
jQuery.each( (
"checked selected async autofocus autoplay controls defer disabled " +
"hidden ismap loop multiple open readonly required scoped"
).split( " " ), function( _i, name ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
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 fromHTML Attributes, includes ascoped that isn't even present there, and treatshidden as boolean despite the expansion of that attribute to be an enumeration including "until-found" bywhatwg/html@f5def65 .

Copy link
MemberAuthor

@mgolmgolJan 10, 2024
edited
Loading

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 likechecked &selected. Thoughts,@timmywil@gibson042?

EDIT: extracted to#5388, let's discuss this issue there

Copy link
MemberAuthor

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>
@mgolmgol added this to the4.0.0 milestoneJan 12, 2024
@mgolmgol merged commite06ff08 intojquery:mainJan 12, 2024
@mgolmgol deleted the selector-attr-dependency branchJanuary 12, 2024 00:18
mgol added a commit to mgol/jquery-migrate that referenced this pull requestFeb 3, 2024
Injquery/jquery#5384, `jQuery.expr.match.bool` stopped being defined and theregex matching boolean attributes is no longer exposed. Inline it in Migrateto avoid it crashing on jQuery 4.x.Fixesjquerygh-495
mgol added a commit to jquery/jquery-migrate that referenced this pull requestFeb 3, 2024
Injquery/jquery#5384, `jQuery.expr.match.bool` stopped being defined and theregex matching boolean attributes is no longer exposed. Inline it in Migrateto avoid it crashing on jQuery 4.x.Fixesgh-495Closesgh-496
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timmywiltimmywiltimmywil approved these changes

@gibson042gibson042gibson042 approved these changes

Assignees

@mgolmgol

Labels
Milestone
4.0.0
Development

Successfully merging this pull request may close these issues.

Strange error behavior of event delegation when customizing jQuery
3 participants
@mgol@timmywil@gibson042

[8]ページ先頭

©2009-2025 Movatter.jp