diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b84057..08b7fdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,6 @@ ## Unreleased -- Fixed parsing pseudo element selectors. - ## v2.11.4 - Fixed parsing unclosed attribute selector (such as `a[href`). diff --git a/parser.d.ts b/parser.d.ts index 701a8b6..502da01 100644 --- a/parser.d.ts +++ b/parser.d.ts @@ -12,8 +12,7 @@ type GetLastTag = I extends `${string}${Combinators}${infer Right}` : GetLastTag : I -type PseudoFirstChar = - | ':' +type PseudoClassesFirstChar = | 'a' | 'b' | 'c' @@ -109,9 +108,9 @@ type PostprocessEachUnchecked = ? PostprocessEachUnchecked<`${Tag}&${Rest}`> : I extends `${infer Tag}#${string}` ? PostprocessEachUnchecked - : I extends `${infer Tag}:${PseudoFirstChar}${string}&${infer Rest}` + : I extends `${infer Tag}:${PseudoClassesFirstChar}${string}&${infer Rest}` ? PostprocessEachUnchecked<`${Tag}&${Rest}`> - : I extends `${infer Tag}:${PseudoFirstChar}${string}` + : I extends `${infer Tag}:${PseudoClassesFirstChar}${string}` ? PostprocessEachUnchecked : I extends `${string}|${infer Tag}` // namespace prefix ? PostprocessEachUnchecked diff --git a/parser.test.ts b/parser.test.ts index 35f7c47..4f1e5ab 100644 --- a/parser.test.ts +++ b/parser.test.ts @@ -357,7 +357,6 @@ type _Tests = [ >, Expect, Element>>, Expect, Element>>, - Expect, HTMLAnchorElement>>, ] declare function delegate<