Commit 276a4b2 1 parent f07d582 commit 276a4b2 Copy full SHA for 276a4b2
File tree 2 files changed +7
-11
lines changed
2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ const broken = [
32
32
"[id=012345678901234567890123456789" ,
33
33
"input[name=foo.baz]" ,
34
34
"input[name=foo[baz]]" ,
35
+ ':has("p")' ,
35
36
] ;
36
37
37
38
describe ( "Broken selectors" , ( ) => {
Original file line number Diff line number Diff line change @@ -311,22 +311,17 @@ function parseSelector(
311
311
312
312
if ( selector . startsWith ( "(" ) ) {
313
313
if ( unpackPseudos . has ( name ) ) {
314
- const quot = selector . charAt ( 1 ) ;
315
- const quoted = quotes . has ( quot ) ;
314
+ if ( quotes . has ( selector . charAt ( 1 ) ) ) {
315
+ throw new Error (
316
+ `Pseudo-selector ${ name } cannot be quoted`
317
+ ) ;
318
+ }
316
319
317
- selector = selector . substr ( quoted ? 2 : 1 ) ;
320
+ selector = selector . substr ( 1 ) ;
318
321
319
322
data = [ ] ;
320
323
selector = parseSelector ( data , selector , options ) ;
321
324
322
- if ( quoted ) {
323
- if ( ! selector . startsWith ( quot ) ) {
324
- throw new Error ( `Unmatched quotes in :${ name } ` ) ;
325
- } else {
326
- selector = selector . substr ( 1 ) ;
327
- }
328
- }
329
-
330
325
if ( ! selector . startsWith ( ")" ) ) {
331
326
throw new Error (
332
327
`Missing closing parenthesis in :${ name } (${ selector } )`
You can’t perform that action at this time.
0 commit comments