Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- _Experimental_: Add `@container-size` utility ([#18901](https://github.com/tailwindlabs/tailwindcss/pull/18901))

### Fixed

- Discard candidates with an empty data type ([#19172](https://github.com/tailwindlabs/tailwindcss/pull/19172))

## [4.1.15] - 2025-10-20

### Fixed
Expand Down
8 changes: 8 additions & 0 deletions packages/tailwindcss/src/candidate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1776,6 +1776,14 @@ it('should not parse compound group with a non-compoundable variant', () => {
expect(run('group-*:flex', { utilities, variants })).toMatchInlineSnapshot(`[]`)
})

it('empty data types are invalid', () => {
let utilities = new Utilities()
utilities.functional('bg', () => [])
let variants = new Variants()

expect(run('bg-[:foo]', { utilities, variants })).toMatchInlineSnapshot(`[]`)
})

it('should parse a variant containing an arbitrary string with unbalanced parens, brackets, curlies and other quotes', () => {
let utilities = new Utilities()
utilities.static('flex', () => [])
Expand Down
4 changes: 3 additions & 1 deletion packages/tailwindcss/src/candidate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ export function* parseCandidate(input: string, designSystem: DesignSystem): Iter
if (!isValidArbitrary(arbitraryValue)) continue

// Extract an explicit typehint if present, e.g. `bg-[color:var(--my-var)])`
let typehint = ''
let typehint: string | null = null
for (let i = 0; i < arbitraryValue.length; i++) {
let code = arbitraryValue.charCodeAt(i)

Expand All @@ -580,6 +580,8 @@ export function* parseCandidate(input: string, designSystem: DesignSystem): Iter
continue
}

if (typehint === '') continue

candidate.value = {
kind: 'arbitrary',
dataType: typehint || null,
Expand Down