Repository navigation
Commit 18207e7
authored
fix: Don't inherit registered custom properties without initial values (#930)
A follow-up to #921. A custom property registered with `inherits: false`
and no initial value has the guaranteed-invalid value in elements that
don't declare it, so `var()` uses its fallback. Tailwind v4 registers
`--tw-leading` this way:
```css
@Property --tw-leading { syntax: "*"; inherits: false; }
.text-sm { line-height: var(--tw-leading, var(--text-sm--line-height)); }
.leading-5 { --tw-leading: 1.25rem; line-height: 1.25rem; }
```
So `text-sm` inside a `leading-5` element uses its own line height in
browsers. #921 only handled registered properties with an initial value,
so in Satori, children inherited the parent's `--tw-leading`.
Now, like properties with an initial value, the children of an element
that declares such a property get `initial`, which Satori already treats
as the guaranteed-invalid value.
A new test checks that a child uses the fallback of `var()` while its
parent uses its own value. It fails without this change. The benchmark
doesn't change.1 parent b75a07b commit 18207e7
2 files changed
Lines changed: 20 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
458 | | - | |
459 | | - | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
460 | 461 | | |
461 | | - | |
| 462 | + | |
462 | 463 | | |
463 | 464 | | |
464 | 465 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
421 | 436 | | |
422 | 437 | | |
423 | 438 | | |
| |||
0 commit comments