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: Inline Sizzle into the selector module: 3.x version#5113

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 65 commits intojquery:3.x-stablefrommgol:3.x-inline-sizzle
Dec 14, 2022

Conversation

@mgol
Copy link
Member

@mgolmgol commentedSep 9, 2022
edited
Loading

Summary

The first commit is a cherry-pick of#4406.

The next commits are cherry-picks of the branch from which I landed#4395; see that PR for more details about this part. The last commit from this batch is named "Selector: Reduce selector-native.js". NOTE: not all of the changes were backported as on3.x-stable we need to maintain backwards compatibility. The end ofsrc/selector.js consists of a lot of assignments tojQuery.find to keep the old Sizzle interface intact.

All the subsequent commits are largely backporting changes tosrc/selector.js &src/selector/**/* that landed after#4395 and changes from Sizzle after the backport was done.

Some last commits are fixing minor browser issues.

This PR passes all jQuery tests in latest Firefox, Chrome & IE 9-11. All Sizzle tests also pass withSizzle = jQuery.find.There are minor issues in iOS 7 (just 2 tests failing that I'll fix) and I still need to verify old Android and generally all remaining browsers supported by 3.x. But considering IE is goodand old iOS has only minor issues, I'm optimistic this can work.

I'd love somepreliminary reviews of this.

-851 bytes as of0715705.

TODO for me:

Checklist

@mgolmgol added Selector Needs review Discuss in MeetingReserved for Issues and PRs that anyone would like to discuss in the weekly meeting. labelsSep 9, 2022
@mgolmgol added this to the3.7.0 milestoneSep 9, 2022
@mgolmgol self-assigned thisSep 9, 2022
@mgol
Copy link
MemberAuthor

mgol commentedSep 9, 2022
edited
Loading

CI is failing due to Chrome:has issues I’m fixing in#5107.

@mgol
Copy link
MemberAuthor

-846 bytes as of051909a.

@mgol
Copy link
MemberAuthor

mgol commentedSep 13, 2022
edited
Loading

I fixed iOS 7+ & Android 4.0-4.3 selector tests and I verified it by running both Sizzle & selector tests (from this branch) on iOS 7 & Android 4.0-4.2 (4.3 is not available in BrowserStack Live). I also run TestSwarm on this branch on the 3.x browsers athttps://swarm.jquery.org/job/12556, results are green.

This looks good to go. Of course, just before merging I'll double check if there are any fixes to CP before merging (most notably,jquery/sizzle#486) but for now this is it! 🎉

@mgolmgol marked this pull request as ready for reviewSeptember 13, 2022 15:16
@mgol
Copy link
MemberAuthor

I also run the entire jQuery test suite on Android 4.0 on this branch (it took ages to run!) and there were only two minor.offset() failures, likely unrelated to this PR.

// Testing for detecting duplicates is unpredictable so instead assume we can't
// depend on duplicate detection in all browsers without a stable sort.
hasDuplicate=!support.sortStable;
sortInput=!support.sortStable&&slice.call(results,0);
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

The last change in Sizzle affectingsupport.detectDuplicates landed injquery/sizzle@07a5f1f but I had trouble relying on it. Even in Chrome the test sometimes was failing, despite my various attempts withexpando tweaks for the test.

Since both of those tests only fail in Android Browser 4.x fro all of our supported browsers in jQuery 3.x, I started usingsupport.sortStable here instead.

@mgolmgolforce-pushed the3.x-inline-sizzle branch 3 times, most recently from13bc0d0 to5f88f31CompareSeptember 21, 2022 14:09
@mgolmgol removed the Discuss in MeetingReserved for Issues and PRs that anyone would like to discuss in the weekly meeting. labelSep 21, 2022
@mgol
Copy link
MemberAuthor

@timmywil@gibson042 this is passing on GitHub now; it's ready for a final review.

@mgolmgolforce-pushed the3.x-inline-sizzle branch 2 times, most recently from77fe8c0 toac6fe32CompareOctober 4, 2022 21:27
@mgol
Copy link
MemberAuthor

mgol commentedOct 7, 2022

@timmywil@gibson042 If you want, I can extract test changes to a separate PR to be landed first. That way, this PR would be smaller and we'd have additional validation for the tests that they work in the same way both with the old & new implementation.

@mgolmgolforce-pushed the3.x-inline-sizzle branch 3 times, most recently frome6a0927 to53e16aeCompareOctober 11, 2022 10:54
@mgol
Copy link
MemberAuthor

I rebased the PR & I added 4 new commits (the first one being titled "Selector:Manipulation: Fix DOM manip within template contents"). This is mostly to address items from other PRs and what already landed in Sizzle / jQuerymain.

That way, `/* eslint-enable */` comments won't re-enable the rule.
jQuery has followed the following logic for selector handling for ages:1. Modify the selector to adhere to scoping rules jQuery mandates.2. Try `qSA` on the modified selector. If it succeeds, use the results.3. If `qSA` threw an error, run the jQuery custom traversal instead.It worked fine so far but now CSS has a concept of forgiving selector lists thatsome selectors like `:is()` & `:has()` use. That means providing unrecognizedselectors as parameters to `:is()` & `:has()` no longer throws an error, it willjust return no results. That made browsers with native `:has()` support breakselectors using jQuery extensions inside, e.g. `:has(:contains("Item"))`.Detecting support for selectors can also be done via:```jsCSS.supports( "selector(SELECTOR_TO_BE_TESTED)" )```which returns a boolean. There was a recent spec change requiring this API toalways use non-forgiving parsing:w3c/csswg-drafts#7280 (comment)However, no browsers have implemented this change so far.To solve this, two changes are being made:1. In browsers supports the new spec change to `CSS.supports( "selector()" )`,   use it before trying `qSA`.2. Otherwise, add `:has` to the buggy selectors list.Refjquerygh-5098Refjquerygh-5107Refjquery/sizzle#486Refw3c/csswg-drafts#7676
Backport some changes fromjquerygh-5085 to make selector-native tests pass. Plusa few other fixes.
The tokenization stressor test needs to exclude `.qunit-source` or it sometimesfits into the results.This change has already landed on `main` injquerygh-4550.Refjquerygh-4550
This is a private API but since it's been tested in Sizzle, it makes senseto continue testing it on the jQuery 3.x line.
Previously, they were loaded after test files which meant top level usagewas not evaluated correctly.
This backports custom pseudos tests from Sizzle; they were missed in originaltest backports. Also, the support for legacy custom pseudos has been dropped.The `jQuery.expr` test cleanup has been wrapped in `try-finally` for cleanertest isolation in case anything goes wrong.Refjquerygh-5137
The `<template/>` element `contents` property is a document fragment that mayhave a `null` `documentElement`. In Safari 16 this happens in more cases dueto recent spec changes - in particular, even if that document fragment isexplicitly adopted into an outer document. We're testing both of those casesnow.The crash used to happen in `jQuery.contains`. As it turns out, we don't needto query the supposed container `documentElement` if it has the`Node.DOCUMENT_NODE` (9) `nodeType`; we can call `.contains()` directly onthe `document`. That avoids the crash.Fixesjquerygh-5147Closesjquerygh-5158(cherry picked from commit3299236)
Firefox 106 adjusted to the spec mandating that `CSS.supports("selector(...)")`uses non-forgiving parsing which makes it pass the relevant support test.Closesjquerygh-5141(cherry picked from commit716130e)
@mgolmgol merged commit6306ca4 intojquery:3.x-stableDec 14, 2022
@mgolmgol deleted the 3.x-inline-sizzle branchDecember 14, 2022 00:41
mgol added a commit to mgol/jquery that referenced this pull requestMay 29, 2023
`Sizzle.tokenize` is an internal Sizzle API, but exposed. As a result,it has historically been available in jQuery via `jQuery.find.tokenize`.That got dropped during Sizzle removal; this change restores the API.In addition to that, Sizzle tests have been backported for the followingAPIs:* `jQuery.find.matchesSelector`* `jQuery.find.matches`* `jQuery.find.compile`* `jQuery.find.select`* `jQuery.find.tokenize`Fixesjquerygh-5259Refjquery/sizzle#242Refjquerygh-5113Refjquerygh-4395Refjquerygh-4406
mgol added a commit to mgol/jquery that referenced this pull requestMay 29, 2023
`Sizzle.tokenize` is an internal Sizzle API, but exposed. As a result,it has historically been available in jQuery via `jQuery.find.tokenize`.That got dropped during Sizzle removal; this change restores the API.In addition to that, Sizzle tests have been backported for the followingAPIs:* `jQuery.find.matchesSelector`* `jQuery.find.matches`* `jQuery.find.compile`* `jQuery.find.select`* `jQuery.find.tokenize`Fixesjquerygh-5259Refjquery/sizzle#242Refjquerygh-5113Refjquerygh-4395Refjquerygh-4406
mgol added a commit to mgol/jquery that referenced this pull requestMay 29, 2023
`Sizzle.tokenize` is an internal Sizzle API, but exposed. As a result,it has historically been available in jQuery via `jQuery.find.tokenize`.That got dropped during Sizzle removal; this change restores the API.In addition to that, Sizzle tests have been backported for the followingAPIs:* `jQuery.find.matchesSelector`* `jQuery.find.matches`* `jQuery.find.compile`* `jQuery.find.select`* `jQuery.find.tokenize`Fixesjquerygh-5259Refjquery/sizzle#242Refjquerygh-5113Refjquerygh-4395Refjquerygh-4406
mgol added a commit to mgol/jquery that referenced this pull requestMay 29, 2023
`Sizzle.tokenize` is an internal Sizzle API, but exposed. As a result,it has historically been available in jQuery via `jQuery.find.tokenize`.That got dropped during Sizzle removal; this change restores the API.In addition to that, Sizzle tests have been backported for the followingAPIs:* `jQuery.find.matchesSelector`* `jQuery.find.matches`* `jQuery.find.compile`* `jQuery.find.select`* `jQuery.find.tokenize`Fixesjquerygh-5259Refjquery/sizzle#242Refjquerygh-5113Refjquerygh-4395Refjquerygh-4406
mgol added a commit to mgol/jquery that referenced this pull requestMay 30, 2023
`Sizzle.tokenize` is an internal Sizzle API, but exposed. As a result,it has historically been available in jQuery via `jQuery.find.tokenize`.That got dropped during Sizzle removal; this change restores the API.In addition to that, Sizzle tests have been backported for the followingAPIs:* `jQuery.find.matchesSelector`* `jQuery.find.matches`* `jQuery.find.compile`* `jQuery.find.select`A new test was also added for `jQuery.find.tokenize` - even Sizzle wasmissing one.Fixesjquerygh-5259Refjquery/sizzle#242Refjquerygh-5113Refjquerygh-4395Refjquerygh-4406
mgol added a commit to mgol/jquery that referenced this pull requestMay 31, 2023
`Sizzle.tokenize` is an internal Sizzle API, but exposed. As a result,it has historically been available in jQuery via `jQuery.find.tokenize`.That got dropped during Sizzle removal; this change restores the API.In addition to that, Sizzle tests have been backported for the followingAPIs:* `jQuery.find.matchesSelector`* `jQuery.find.matches`* `jQuery.find.compile`* `jQuery.find.select`A new test was also added for `jQuery.find.tokenize` - even Sizzle wasmissing one.Fixesjquerygh-5259Refjquery/sizzle#242Refjquerygh-5113Refjquerygh-4395Refjquerygh-4406
mgol added a commit to mgol/jquery that referenced this pull requestJun 1, 2023
`Sizzle.tokenize` is an internal Sizzle API, but exposed. As a result,it has historically been available in jQuery via `jQuery.find.tokenize`.That got dropped during Sizzle removal; this change restores the API.In addition to that, Sizzle tests have been backported for the followingAPIs:* `jQuery.find.matchesSelector`* `jQuery.find.matches`* `jQuery.find.compile`* `jQuery.find.select`A new test was also added for `jQuery.find.tokenize` - even Sizzle wasmissing one.Fixesjquerygh-5259Refjquerygh-5260Refjquery/sizzle#242Refjquerygh-5113Refjquerygh-4395Refjquerygh-4406
mgol added a commit to mgol/jquery that referenced this pull requestJun 1, 2023
`Sizzle.tokenize` is an internal Sizzle API, but exposed. As a result,it has historically been available in jQuery via `jQuery.find.tokenize`.That got dropped during Sizzle removal; this change restores the API.In addition to that, Sizzle tests have been backported for the followingAPIs:* `jQuery.find.matchesSelector`* `jQuery.find.matches`* `jQuery.find.compile`* `jQuery.find.select`A new test was also added for `jQuery.find.tokenize` - even Sizzle wasmissing one.Fixesjquerygh-5259Refjquerygh-5263Refjquery/sizzle#242Refjquerygh-5113Refjquerygh-4395Refjquerygh-4406
mgol added a commit to mgol/jquery that referenced this pull requestJun 1, 2023
`Sizzle.tokenize` is an internal Sizzle API, but exposed. As a result,it has historically been available in jQuery via `jQuery.find.tokenize`.That got dropped during Sizzle removal; this change restores the API.Some other APIs so far only exposed on the `3.x` line are also addedback:* `jQuery.find.select`* `jQuery.find.compile`* `jQuery.find.setDocument`In addition to that, Sizzle tests have been backported for the followingAPIs:* `jQuery.find.matchesSelector`* `jQuery.find.matches`* `jQuery.find.compile`* `jQuery.find.select`A new test was also added for `jQuery.find.tokenize` - even Sizzle wasmissing one.Fixesjquerygh-5259Refjquerygh-5260Refjquery/sizzle#242Refjquerygh-5113Refjquerygh-4395Refjquerygh-4406
mgol added a commit that referenced this pull requestJun 12, 2023
`Sizzle.tokenize` is an internal Sizzle API, but exposed. As a result,it has historically been available in jQuery via `jQuery.find.tokenize`.That got dropped during Sizzle removal; this change restores the API.Some other APIs so far only exposed on the `3.x` line are also addedback:* `jQuery.find.select`* `jQuery.find.compile`* `jQuery.find.setDocument`In addition to that, Sizzle tests have been backported for the followingAPIs:* `jQuery.find.matchesSelector`* `jQuery.find.matches`* `jQuery.find.compile`* `jQuery.find.select`A new test was also added for `jQuery.find.tokenize` - even Sizzle wasmissing one.Fixesgh-5259Closesgh-5263Refgh-5260Refjquery/sizzle#242Refgh-5113Refgh-4395Refgh-4406
mgol added a commit that referenced this pull requestJun 12, 2023
`Sizzle.tokenize` is an internal Sizzle API, but exposed. As a result,it has historically been available in jQuery via `jQuery.find.tokenize`.That got dropped during Sizzle removal; this change restores the API.In addition to that, Sizzle tests have been backported for the followingAPIs:* `jQuery.find.matchesSelector`* `jQuery.find.matches`* `jQuery.find.compile`* `jQuery.find.select`A new test was also added for `jQuery.find.tokenize` - even Sizzle wasmissing one.Fixesgh-5259Closesgh-5260Refgh-5263Refjquery/sizzle#242Refgh-5113Refgh-4395Refgh-4406
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsSep 24, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@timmywiltimmywiltimmywil approved these changes

@gibson042gibson042gibson042 approved these changes

Assignees

@mgolmgol

Labels

Milestone

3.7.0

Development

Successfully merging this pull request may close these issues.

3 participants

@mgol@timmywil@gibson042

[8]ページ先頭

©2009-2025 Movatter.jp