Skip to content

Commit

Permalink
fix bare pseudo class or element selector
Browse files Browse the repository at this point in the history
  • Loading branch information
g-plane committed Aug 12, 2024
1 parent 5d69d0c commit 407c7ef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Fixed parsing unclosed attribute selector (such as `a[href`).
- Fixed parsing bare pseudo class or element selectors.

## v2.11.3

Expand Down
2 changes: 2 additions & 0 deletions parser.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ type PseudoClassesFirstChar =

type Split<S> = S extends `${string},` // invalid selector
? unknown
: S extends ''
? ''
: SplitRec<S>
type SplitRec<S, Acc = never> = S extends `${infer Left},${infer Right}`
? SplitRec<Right, Acc | Left>
Expand Down
2 changes: 2 additions & 0 deletions parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ type _Tests = [
Element
>
>,
Expect<Equal<ParseSelector<':func(arg)'>, Element>>,
Expect<Equal<ParseSelector<'::func(arg)'>, Element>>,
]

declare function delegate<
Expand Down

0 comments on commit 407c7ef

Please sign in to comment.