Skip to content

Commit cac8248

Browse files
committed
added support for :any and :-vendor-any
1 parent 36cee5d commit cac8248

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

lib/parse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function getSelectors() {
178178
selectors[uniRegexp.typeMatchClass] = typeMatch("class");
179179
selectors[uniRegexp.typeMatchId] = typeMatch("id");
180180
var selectorsSecondHalf = {
181-
":(not|matches|is|where|has|local|global)\\((\\s*)": nestedPseudoClassStartMatch,
181+
":(not|any|-\\w+?-any|matches|is|where|has|local|global)\\((\\s*)": nestedPseudoClassStartMatch,
182182
":((?:\\\\.|[A-Za-z_\\-0-9])+)\\(": pseudoClassStartMatch,
183183
":((?:\\\\.|[A-Za-z_\\-0-9])+)": typeMatch("pseudo-class"),
184184
"::((?:\\\\.|[A-Za-z_\\-0-9])+)": typeMatch("pseudo-element"),

test/test-cases.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,56 @@ module.exports = {
411411
],
412412
}, ]),
413413
],
414+
"nested pseudo class with multiple selectors (:any)": [
415+
":any( h1, h2 )",
416+
singleSelector([{
417+
type: "nested-pseudo-class",
418+
name: "any",
419+
nodes: [{
420+
type: "selector",
421+
nodes: [{
422+
type: "element",
423+
name: "h1"
424+
}],
425+
before: " ",
426+
},
427+
{
428+
type: "selector",
429+
nodes: [{
430+
type: "element",
431+
name: "h2"
432+
}],
433+
before: " ",
434+
after: " ",
435+
},
436+
],
437+
}, ]),
438+
],
439+
"nested pseudo class with multiple selectors (:-vendor-any)": [
440+
":-vendor-any( h1, h2 )",
441+
singleSelector([{
442+
type: "nested-pseudo-class",
443+
name: "-vendor-any",
444+
nodes: [{
445+
type: "selector",
446+
nodes: [{
447+
type: "element",
448+
name: "h1"
449+
}],
450+
before: " ",
451+
},
452+
{
453+
type: "selector",
454+
nodes: [{
455+
type: "element",
456+
name: "h2"
457+
}],
458+
before: " ",
459+
after: " ",
460+
},
461+
],
462+
}, ]),
463+
],
414464
"available nested pseudo classes": [
415465
":not(:active):matches(:focus)",
416466
singleSelector([

0 commit comments

Comments
 (0)