diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2023-09-20 02:31:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-20 02:31:35 +0200 |
commit | 53cf7244da2a2040333335c36e435b1c12efdff9 (patch) | |
tree | 5331bd464dcc51d7ff1b923ccd5868a733c18234 /src/selector | |
parent | 5f869590924b7dea6a16d176b18700939f4b5290 (diff) | |
download | jquery-53cf7244da2a2040333335c36e435b1c12efdff9.tar.gz jquery-53cf7244da2a2040333335c36e435b1c12efdff9.zip |
CSS:Selector: Align with 3.x, remove the outer `selector.js` wrapper
Bring some changes from `3.x-stable`:
* rename `rtrim` to `rtrimCSS` to distinguish from the previous `rtrim`
regex used for `jQuery.trim`
* backport one `id` selector test that avoids the selector engine path
Other changes:
* remove the inner function wrapper from `selector.js` by renaming
the imported `document.js` value
* use `jQuery.error` in `selectorError`
* make Selector tests pass in all-modules runs by fixing a sinon mistake
in Core tests - Core tests had a spy set up for `jQuery.error` that wasn't
cleaned up, influencing Selector tests when all were run together
Closes gh-5295
Diffstat (limited to 'src/selector')
-rw-r--r-- | src/selector/rbuggyQSA.js | 2 | ||||
-rw-r--r-- | src/selector/selectorError.js | 4 | ||||
-rw-r--r-- | src/selector/tokenize.js | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/src/selector/rbuggyQSA.js b/src/selector/rbuggyQSA.js index 7e4632c7f..b056ffe75 100644 --- a/src/selector/rbuggyQSA.js +++ b/src/selector/rbuggyQSA.js @@ -2,6 +2,8 @@ import { isIE } from "../var/isIE.js"; import { whitespace } from "../var/whitespace.js"; import { support } from "./support.js"; +// Build QSA regex. +// Regex strategy adopted from Diego Perini. export var rbuggyQSA = []; if ( isIE ) { diff --git a/src/selector/selectorError.js b/src/selector/selectorError.js index 69770ec6a..da2b239f9 100644 --- a/src/selector/selectorError.js +++ b/src/selector/selectorError.js @@ -1,3 +1,5 @@ +import { jQuery } from "../core.js"; + export function selectorError( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); + jQuery.error( "Syntax error, unrecognized expression: " + msg ); } diff --git a/src/selector/tokenize.js b/src/selector/tokenize.js index 3c1e06c46..fb25cb207 100644 --- a/src/selector/tokenize.js +++ b/src/selector/tokenize.js @@ -1,7 +1,7 @@ import { jQuery } from "../core.js"; import { rcomma } from "./var/rcomma.js"; import { rleadingCombinator } from "./var/rleadingCombinator.js"; -import { rtrim } from "../var/rtrim.js"; +import { rtrimCSS } from "../var/rtrimCSS.js"; import { createCache } from "./createCache.js"; import { selectorError } from "./selectorError.js"; import { filterMatchExpr } from "./filterMatchExpr.js"; @@ -42,7 +42,7 @@ export function tokenize( selector, parseOnly ) { value: matched, // Cast descendant combinators to space - type: match[ 0 ].replace( rtrim, " " ) + type: match[ 0 ].replace( rtrimCSS, " " ) } ); soFar = soFar.slice( matched.length ); } |