Skip to content

Commit 503570e

Browse files
committed
fix(parse): Fix parsing column combinators after tag names
1 parent c6bdb4c commit 503570e

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/__fixtures__/tests.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,4 +972,25 @@ export const tests: [
972972
],
973973
"column combinator",
974974
],
975+
[
976+
"foo||bar",
977+
[
978+
[
979+
{
980+
name: "foo",
981+
namespace: null,
982+
type: SelectorType.Tag,
983+
},
984+
{
985+
type: SelectorType.ColumnCombinator,
986+
},
987+
{
988+
name: "bar",
989+
namespace: null,
990+
type: SelectorType.Tag,
991+
},
992+
],
993+
],
994+
"column combinator without whitespace",
995+
],
975996
];

src/parse.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,10 @@ function parseSelector(
564564
break loop;
565565
}
566566

567-
if (selector.charCodeAt(selectorIndex) === CharCode.Pipe) {
567+
if (
568+
selector.charCodeAt(selectorIndex) === CharCode.Pipe &&
569+
selector.charCodeAt(selectorIndex + 1) !== CharCode.Pipe
570+
) {
568571
namespace = name;
569572
if (
570573
selector.charCodeAt(selectorIndex + 1) ===

0 commit comments

Comments
 (0)