Skip to content

Commit

Permalink
fix(parse): Fix parsing column combinators after tag names
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Dec 27, 2021
1 parent c6bdb4c commit 503570e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/__fixtures__/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -972,4 +972,25 @@ export const tests: [
],
"column combinator",
],
[
"foo||bar",
[
[
{
name: "foo",
namespace: null,
type: SelectorType.Tag,
},
{
type: SelectorType.ColumnCombinator,
},
{
name: "bar",
namespace: null,
type: SelectorType.Tag,
},
],
],
"column combinator without whitespace",
],
];
5 changes: 4 additions & 1 deletion src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,10 @@ function parseSelector(
break loop;
}

if (selector.charCodeAt(selectorIndex) === CharCode.Pipe) {
if (
selector.charCodeAt(selectorIndex) === CharCode.Pipe &&
selector.charCodeAt(selectorIndex + 1) !== CharCode.Pipe
) {
namespace = name;
if (
selector.charCodeAt(selectorIndex + 1) ===
Expand Down

0 comments on commit 503570e

Please sign in to comment.