From db4dd402ba63715532e19c5ffebe7509e227ae4b Mon Sep 17 00:00:00 2001 From: Wilco Fiers Date: Thu, 27 Mar 2025 14:02:20 +0100 Subject: [PATCH 1/2] fix: ::part() takes a string, not a selector --- src/syntax-definitions.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/syntax-definitions.ts b/src/syntax-definitions.ts index fdf3896..ed0df9a 100644 --- a/src/syntax-definitions.ts +++ b/src/syntax-definitions.ts @@ -403,7 +403,7 @@ const selectors4SyntaxDefinition = extendSyntaxDefinition(selectors3SyntaxDefini pseudoElements: { definitions: { NoArgument: ['marker'], - Selector: ['part'] + String: ['part'] } } }); @@ -489,7 +489,7 @@ export const cssModules = { latest: true, pseudoElements: { definitions: { - Selector: ['part'] + String: ['part'] } } } From e6bcef677a0dddaf413fd8a1a782bb58654d3d49 Mon Sep 17 00:00:00 2001 From: Wilco Fiers Date: Thu, 27 Mar 2025 14:50:10 +0100 Subject: [PATCH 2/2] update tests --- src/syntax-definitions.ts | 3 +-- test/modules.test.ts | 40 +++++---------------------------------- 2 files changed, 6 insertions(+), 37 deletions(-) diff --git a/src/syntax-definitions.ts b/src/syntax-definitions.ts index ed0df9a..ec9b3ea 100644 --- a/src/syntax-definitions.ts +++ b/src/syntax-definitions.ts @@ -402,8 +402,7 @@ const selectors4SyntaxDefinition = extendSyntaxDefinition(selectors3SyntaxDefini }, pseudoElements: { definitions: { - NoArgument: ['marker'], - String: ['part'] + NoArgument: ['marker'] } } }); diff --git a/test/modules.test.ts b/test/modules.test.ts index 671a17b..aac00a1 100644 --- a/test/modules.test.ts +++ b/test/modules.test.ts @@ -397,13 +397,7 @@ describe('CSS Modules', () => { items: [ ast.pseudoElement({ name: 'part', - argument: ast.selector({ - rules: [ - ast.rule({ - items: [ast.tagName({name: 'button'})] - }) - ] - }) + argument: ast.string({value: 'button'}) }) ] }) @@ -444,13 +438,7 @@ describe('CSS Modules', () => { items: [ ast.pseudoElement({ name: 'part', - argument: ast.selector({ - rules: [ - ast.rule({ - items: [ast.tagName({name: 'button'})] - }) - ] - }) + argument: ast.string({value: 'button'}) }) ] }) @@ -465,13 +453,7 @@ describe('CSS Modules', () => { items: [ ast.pseudoElement({ name: 'part', - argument: ast.selector({ - rules: [ - ast.rule({ - items: [ast.tagName({name: 'button-primary'})] - }) - ] - }) + argument: ast.string({value: 'button-primary'}) }) ] }) @@ -635,13 +617,7 @@ describe('CSS Modules', () => { items: [ ast.pseudoElement({ name: 'part', - argument: ast.selector({ - rules: [ - ast.rule({ - items: [ast.tagName({name: 'button'})] - }) - ] - }) + argument: ast.string({value: 'button'}) }) ] }) @@ -677,13 +653,7 @@ describe('CSS Modules', () => { items: [ ast.pseudoElement({ name: 'part', - argument: ast.selector({ - rules: [ - ast.rule({ - items: [ast.tagName({name: 'button'})] - }) - ] - }) + argument: ast.string({value: 'button'}) }) ] })