Repository navigation
Inherit custom properties with var() already substituted - #276
Merged
Merged
Conversation
eXpl0it3r
force-pushed
the
fix/custom-property-inheritance
branch
from
November 10, 2026 19:06
ff5e396 to
7cabe0a
Compare
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.
A custom property that references another one got inherited with its
var()still in it, so the child substituted it against its own custom properties. With<div style="--a: red; --b: var(--a)"><p style="--a: blue; color: var(--b)">the paragraph ended up blue, while it should be red, because the computed value of a custom property already has its variables substituted and that's what inherits (CSS Variables 1, section 2). The same applied to cycles, a custom property that's invalid on the parent could turn valid again on a child.The cascade now resolves a box's custom properties to their computed values once all declarations are applied, before the deferred
var()properties are resolved and before the children inherit them. Cyclic or otherwise invalid custom properties end up as the guaranteed-invalid value, i.e. they're dropped, so the child sees them as missing and uses the fallback.How to test this PR?
CI should succeed.
CustomProperty_IsInheritedWithVarSubstitutedOnTheParent,CustomProperty_IsInheritedWithVarSubstitutedOnEachAncestorandCyclicCustomProperty_IsInheritedAsGuaranteedInvalidinCustomPropertyTestscover the inheritance of resolved and invalid custom properties and fail on master.InheritedProperty_UsingVar_InheritsTheParentsResolvedValuechecks that a regular inherited property usingvar()keeps the parent's value, which already worked.