Repository navigation
fix(compiler): ignore an @property whose initial value depends on the element - #599
Merged
danstepanov merged 1 commit intoDec 4, 2026
Conversation
YevheniiKotyrlo
marked this pull request as ready for review
December 2, 2026 16:54
sammoore
approved these changes
Dec 3, 2026
sammoore
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Thanks for this one!
… element An @Property initial-value must be computationally independent (css-properties-values-api-1 §3). A registration whose initial value uses a font- or container-relative unit (em, rem, ch, lh, cq*, ...), including inside calc(), a math function or a transform, is invalid, and browsers ignore it, so the earlier registration of its name stays in force.
danstepanov
force-pushed
the
fix/property-initial-value-independence
branch
from
December 4, 2026 03:11
096656d to
ccc6848
Compare
danstepanov
approved these changes
Dec 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An
@propertyinitial-valuemust be computationally independent (css-properties-values-api-1, theinitial-valuedescriptor), so a registration whose initial value uses a font- or container-relative unit (em,rem,ch,lh,cq*, …), including insidecalc(), a math function or a transform function, is invalid, and the earlier registration of its name stays in force. Chromium 153, Firefox 155 and WebKit 26.6 ignore one in a font-relative unit; Chromium and WebKit also ignore one in acq*unit, which Firefox still registers. The compiler registers every one.Solution
src/compiler/computational-independence.tsdecides whether an initial value is computationally independent, andcollectRegistrationsskips a registration whose initial value is not. An<image>initial value is kept as written.This is the patch split out of #412, whose
inherits: falsepart landed in #567, with one change: the inliner test declares its variable on:root, since #592 folds a single declaration only within its own block.Tests
src/__tests__/compiler/property.test.ts: an ignored registration leaves the earlier one of its name; initial values in units and math functions, and the<transform-function>/<transform-list>cases, decide validity; an<image>registration with an element-relative stop still decides its name; an ignored non-inheriting registration lets the inliner fold a:rootdeclaration of its name.src/__tests__/native/non-inheriting-variables.test.tsx: an ignored non-inheriting registration lets the property inherit, and an ignored registration leaves the earlier one of its name in force.Verification
A local replica of CI passes every job on Node 26.12.1, where
.nvmrcpins 24.22.3: lint and typecheck,yarn test --maxWorkers=2 --coverage(2268 passed), the library build withnode --test, the web export and commitlint in Ubuntu, and the iOS dev build on macOS with Xcode 27.2, whereci.ymlpins 26.6.