diff --git a/packages/tailwindcss/src/selector-parser.test.ts b/packages/tailwindcss/src/selector-parser.test.ts index e0aacdbd1..e66abd90b 100644 --- a/packages/tailwindcss/src/selector-parser.test.ts +++ b/packages/tailwindcss/src/selector-parser.test.ts @@ -21,6 +21,18 @@ describe('parse', () => { ]) }) + it('should parse a pseudo-element selector with double ::', () => { + expect(parse('.foo::before')).toEqual([ + { + kind: 'compound', + nodes: [ + { kind: 'selector', value: '.foo' }, + { kind: 'selector', value: '::before' }, + ], + }, + ]) + }) + it('should parse a selector list', () => { expect(parse('.foo,.bar')).toEqual([ { diff --git a/packages/tailwindcss/src/selector-parser.ts b/packages/tailwindcss/src/selector-parser.ts index c55b58bb6..fcc78b2e9 100644 --- a/packages/tailwindcss/src/selector-parser.ts +++ b/packages/tailwindcss/src/selector-parser.ts @@ -387,6 +387,11 @@ export function parse(input: string) { case FULL_STOP: case COLON: case NUMBER_SIGN: { + if (currentChar === COLON && buffer === ':') { + buffer += input[i] + break + } + // Handle everything before the combinator as a selector and // start a new selector if (buffer.length > 0) {