mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Don't crash when given applying a variant to a negated version of a simple utility (#12514)
* Don't crash when given applying a variant to a negated version of a simple utility * Update changelog
This commit is contained in:
parent
3713207744
commit
bbfb5a3c66
@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Don't emit `@config` in CSS when watching via the CLI ([#12327](https://github.com/tailwindlabs/tailwindcss/pull/12327))
|
||||
- Improve types for `resolveConfig` ([#12272](https://github.com/tailwindlabs/tailwindcss/pull/12272))
|
||||
- Ensure configured `font-feature-settings` for `mono` are included in Preflight ([#12342](https://github.com/tailwindlabs/tailwindcss/pull/12342))
|
||||
- Don't crash when given applying a variant to a negated version of a simple utility ([#12514](https://github.com/tailwindlabs/tailwindcss/pull/12514))
|
||||
|
||||
## [3.3.5] - 2023-10-25
|
||||
|
||||
|
||||
@ -845,6 +845,11 @@ function applyFinalFormat(match, { context, candidate }) {
|
||||
return null
|
||||
}
|
||||
|
||||
// If all rules have been eliminated we can skip this candidate entirely
|
||||
if (container.nodes.length === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
match[1] = container.nodes[0]
|
||||
|
||||
return match
|
||||
|
||||
@ -343,4 +343,24 @@ crosscheck(() => {
|
||||
return expect(result.css).toMatchCss(css``)
|
||||
})
|
||||
})
|
||||
|
||||
// This is a weird test but it used to crash because the negative prefix + variant used to cause an undefined utility to be generated
|
||||
test('addUtilities without negative prefix + variant + negative prefix in content should not crash', async () => {
|
||||
let config = {
|
||||
content: [{ raw: html`<div class="hover:-top-lg"></div>` }],
|
||||
plugins: [
|
||||
({ addUtilities }) => {
|
||||
addUtilities({
|
||||
'.top-lg': {
|
||||
top: '6rem',
|
||||
},
|
||||
})
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
let result = await run('@tailwind utilities', config)
|
||||
|
||||
expect(result.css).toMatchCss(css``)
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user