Don’t add spaces to negative numbers following a comma (#12324)

* Don’t add spaces to negative numbers following a comma

* Update changelog
This commit is contained in:
Jordan Pittman 2023-10-30 10:47:24 -04:00
parent 9db2d68295
commit b6d5eca564
3 changed files with 9 additions and 2 deletions

View file

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- Don’t add spaces to negative numbers following a comma ([#12324](https://github.com/tailwindlabs/tailwindcss/pull/12324))
## [3.3.5] - 2023-10-25
### Fixed

View file

@ -77,7 +77,7 @@ export function normalize(value, context = null, isRoot = true) {
/**
* Add spaces around operators inside math functions
* like calc() that do not follow an operator or '('.
* like calc() that do not follow an operator, '(', or `,`.
*
* @param {string} value
* @returns {string}
@ -164,7 +164,7 @@ function normalizeMathOperatorSpacing(value) {
// Handle operators
else if (
['+', '-', '*', '/'].includes(char) &&
!['(', '+', '-', '*', '/'].includes(lastChar())
!['(', '+', '-', '*', '/', ','].includes(lastChar())
) {
result += ` ${char} `
} else {

View file

@ -69,6 +69,9 @@ let table = [
['calc(theme(spacing.foo-2))', 'calc(theme(spacing.foo-2))'],
['calc(theme(spacing.foo-bar))', 'calc(theme(spacing.foo-bar))'],
// A negative number immediately after a `,` should not have spaces inserted
['clamp(-3px+4px,-3px+4px,-3px+4px)', 'clamp(-3px + 4px,-3px + 4px,-3px + 4px)'],
// Prevent formatting inside `var()` functions
['calc(var(--foo-bar-bar)*2)', 'calc(var(--foo-bar-bar) * 2)'],