-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Selector: Stop relying on CSS.supports( "selector(...)" ) #5206
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,20 @@ | ||
| import document from "../var/document.js"; | ||
| import support from "../var/support.js"; | ||
|
|
||
| // Support: IE 11+ | ||
| // IE doesn't support `CSS.supports( "selector(...)" )`; it will throw | ||
| // in this support test. | ||
| // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ | ||
| // Make sure the the `:has()` argument is parsed unforgivingly. | ||
| // We include `*` in the test to detect buggy implementations that are | ||
| // _selectively_ forgiving (specifically when the list includes at least | ||
| // one valid selector). | ||
| // Note that we treat complete lack of support for `:has()` as if it were | ||
| // spec-compliant support, which is fine because use of `:has()` in such | ||
| // environments will fail in the qSA path and fall back to jQuery traversal | ||
| // anyway. | ||
| try { | ||
| /* eslint-disable no-undef */ | ||
|
|
||
| // Support: Chrome 105+, Firefox <106, Safari 15.4+ | ||
| // Make sure forgiving mode is not used in `CSS.supports( "selector(...)" )`. | ||
| // | ||
| // `:is()` uses a forgiving selector list as an argument and is widely | ||
| // implemented, so it's a good one to test against. | ||
| support.cssSupportsSelector = CSS.supports( "selector(*)" ) && | ||
|
|
||
| // `*` is needed as Safari & newer Chrome implemented something in between | ||
| // for `:has()` - it throws in `qSA` if it only contains an unsupported | ||
| // argument but multiple ones, one of which is supported, are fine. | ||
| // We want to play safe in case `:is()` gets the same treatment. | ||
| !CSS.supports( "selector(:is(*,:jqfake))" ); | ||
|
|
||
| /* eslint-enable */ | ||
| document.querySelector( ":has(*,:jqfake)" ); | ||
| support.cssHas = false; | ||
| } catch ( e ) { | ||
| support.cssSupportsSelector = false; | ||
| support.cssHas = true; | ||
| } | ||
|
|
||
| export default support; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.