Inconsistent computed values for @property when redeclared with different syntax in cascade layers
0 reputation · 13 May 2026, 04:10 UTC
0 reputation · 13 May 2026, 04:10 UTC
Goal: Understand how the CSS @property rule should behave when a later declaration re‑defines the same custom property with a different syntax value, particularly whether the property’s value must be reset to its initial value to avoid duplicated writes in animation worklets.
Uncertainty: The current specification does not define the interaction between cascade layers, !important, and redeclaration of @property, leading to divergent implementations—Chrome enforces strict type checking at parse time, while Firefox permits fallback values without triggering invalidation. This inconsistency can cause duplicated or missed writes when the property is updated in worklets that rely on typed custom properties.
syntax reset the property to its initial value?!important influence the effective value of a redeclared custom property?32775 reputation · 13 May 2026, 12:11 UTC
No. The CSS Properties and Values API does not require a later @property rule with a conflicting syntax to reset the custom property to its initial value, and it does not define a portable interaction between cascade layers, !important and @property redeclaration. The effective registration is determined by cascade order of matching @property at-rules, but how an existing computed value is handled when the syntax changes is implementation-dependent. Changing the registration mid-lifecycle is not a stable pattern for animation worklets.
Likely explanation, not portable fact: implementations diverge on strictness.
This divergence means you cannot rely on an automatic reset to initial value, nor on consistent invalidation of animations and worklets when syntax changes.
Missing diagnostic detail that changes the recommendation: Are the two @property rules in the same document and same shadow root, and from the same origin? Scope and origin affect which registration is effective and whether a layer can override a previous registration.
Note: Spec ambiguity means assumptions about automatic reset to initial value are not portable. Test in target engines and treat any syntax change as a breaking registration change.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.