Start with a design token that is supposed to supply a color but is authored as --ink: 16px. The consumer is color: var(--ink, red). It is tempting to read that declaration as “use --ink when it is a color; otherwise use red.” That is not the contract var() defines. For an unregistered custom property, 16px is a valid token stream. Because the custom property exists and is usable for substitution, the var() fallback is not selected. Only afterward does the substituted declaration become invalid for color. CSS then performs the invalid-at-computed-value-time behavior for the consuming property; because color inherits, the child receives the parent’s green color rather than the red var() fallback or an earlier blue child declaration. The CSS Custom Properties specification explicitly distinguishes this path from a literal declaration such as color: 16px, which is rejected earlier and therefore leaves the earlier valid declaration available.
This article treats that distinction as an operational validation problem. The cascade selection is held fixed. Twelve independently declared cases separate missing, valid, wrong-for-consumer, empty, initial, cyclic, nested-fallback, non-inherited, and registered-property behavior. Expected outputs are authored before any browser observation. A local fixture creates a fresh rendered iframe for every C01–C12 case and separate qualification frames for the environment and @property behavior. No test was executed while preparing this article, so browser build, operating system, user agent, capability witnesses, actual tuples, and outcomes remain explicitly NOT EXECUTED rather than being fabricated.
The eventual product decision is separate from CSS conformance. A browser can conform while producing a color that violates the design-token contract. When 16px is erroneous color data, the default repair is REPAIR_PRODUCER_VALUE. ADOPT_TYPED_CONTRACT is appropriate only when a reviewed <color> registration, its inheritance rule, and its purple initial value are themselves the intended API. RETAIN_INTENTIONAL_DEFAULTING requires an explicit product decision that inherited or initial consumer behavior is desirable. Missing evidence, failed registration witnesses, unexpected serialization, timeouts, or environmental interference produce HOLD_EVIDENCE_OR_CAPABILITY.
1. Define the color contract before interpreting the fallback
The fixture deliberately uses four conspicuous opaque colors plus transparency. The parent is green. The child has an earlier blue declaration. The later var() declaration contains a red fallback. Purple is the valid token value and also the initial value of the registered-property comparison. Different colors make the paths observable instead of allowing two mechanisms to produce the same pixels.
The independent tuple vocabulary is:
Name | CSS spelling | Expected normalized tuple |
red | red | [255, 0, 0, 1] |
blue | blue | [0, 0, 255, 1] |
green | green | [0, 128, 0, 1] |
purple | purple | [128, 0, 128, 1] |
transparent | transparent | [0, 0, 0, 0] |
These are the fixture’s authored acceptance values, not values learned from the browser under test. The product question is likewise authored first: is --ink intended to be an untyped token whose invalid consumer value deliberately defaults through normal CSS behavior, or is it intended to satisfy a color contract before the consumer sees it?
Three choices remain open until evidence and product policy are reconciled. The producer can be fixed so --ink contains a valid color. The design system can deliberately register a typed color property with defined inheritance and an initial value. Or the team can document that the consumer’s inherited or initial result is intentional. Those are different APIs.
A declaration containing var() can parse successfully without proving that the substituted consumer value will satisfy the consumer grammar. Unregistered custom properties largely store token streams rather than validating them as colors, while registered custom properties add a separate typed contract evaluated according to their registration.
The fixture definition was researched on 2 December 2026 (Africa/Nairobi). No browser execution accompanies that date.
2. Locate the failure after cascade selection
For this bounded investigation, only four processing distinctions matter: declaration parsing, cascade selection, var() substitution, and the consuming property’s computed-value validation.
A literal color: 16px is invalid according to the color grammar before it can win as a usable declaration. An earlier valid color: blue can therefore remain effective. By contrast, color: var(--ink, red) cannot generally be rejected merely because --ink might later contain 16px. The custom-property value is substituted at computed-value time. If the result no longer matches the consuming property’s grammar, the declaration is invalid at computed-value time. For ordinary inherited properties such as color, the resulting behavior is equivalent to unset, so inheritance supplies the value; for a non-inherited property, the initial value supplies it. The Custom Properties Level 1 Candidate Recommendation Snapshot of 16 June 2022 documents this distinction directly.
MDN’s var() reference describes the same practical failure: a custom property can be defined yet contain a value invalid for the property that consumes it. In that situation the later declaration does not recover an earlier declaration merely because the author wrote a fallback inside var().
This article starts after the winning declaration problem. Refonte Learning’s article on cascade-layer migration and winning declarations addresses priority and selection. Here, selector text, origin, importance, and relative rule order are held fixed so that value evaluation is the variable under investigation.
Separate a winning declaration from a usable computed value
Consider these two source fragments:
.target { color: blue; }
.target { color: 16px; }and:
.target { color: blue; }
.target { color: var(--ink, red); }
.target { --ink: 16px; }They look similar only if “invalid” is treated as one undifferentiated state. It is not. The literal 16px fails as a color declaration early enough that the valid blue declaration remains available. In the var() version, --ink: 16px is a valid unregistered custom-property value. It is substituted, after which the consumer fails at computed-value time. The specification notes that by that point the other cascaded value is no longer the recovery path.
Source text, a CSSOM declaration block, and the resolved consumer value therefore answer different questions. Source text preserves what was authored. A parsed CSSStyleRule.style represents declarations the CSS parser retained in that rule. getComputedStyle() exposes resolved values after active styles and value computation have been applied. CSSOM defines declaration storage and serialization separately from resolved-style access; MDN’s getComputedStyle() documentation likewise describes the returned object as live and read-only.
The evidence ledger keeps all three representations instead of treating one as a substitute for the others.
3. Build a fresh, qualified document for every case
The fixture below is a single local HTML file. It makes no network requests. Every C01–C12 case receives a newly created, connected iframe with its own srcdoc; load and error handlers are attached before srcdoc assignment, and each frame has a bounded timeout. The target is measured only after two animation-frame callbacks following load, so the document has reached a rendered state before resolved styles are copied.
Qualification is separate from the twelve cases. A literal-color witness checks that red, blue, green, purple, and transparent serialize into the accepted tuple vocabulary. A registration witness independently checks that an absent registered color yields purple and a valid blue value yields blue. CSS.supports() is recorded as supporting context but cannot substitute for those behavioral witnesses: CSS Conditional Rules Level 3 defines it in terms of supported property/value parsing or evaluated support conditions, not successful completion of this fixture’s consumer calculation.
If forced colors are active, if the color witness does not reproduce the authored literal tuples, or if an extension or other uncontrolled condition visibly changes those literals, the run is held. The fixture does not attempt to change the user’s preferences.
Create the HTML scaffold below. Place the JavaScript that follows in an inline script element after the output element, before the end of the body, then save the complete document as one local HTML file.
HTML scaffold
<!doctype html>
<meta charset="utf-8">
<title>CSS var() fallback invalid computed value fixture</title>
<body>
<pre id="out"></pre>
</body>JavaScript fixture
"use strict";
const FIXTURE_REVISION =
"css-var-fallback-invalid-computed-value-validation-r1";
const RESEARCH_DATE = "2026-12-02";
const RESEARCH_TIMEZONE = "Africa/Nairobi";
const TIMEOUT_MS = 3000;
const RUN_ENVIRONMENT = {
browserBuild: "NOT RECORDED; NOT EXECUTED",
operatingEnvironment: "NOT RECORDED; NOT EXECUTED",
userAgent: "NOT RECORDED; NOT EXECUTED",
testDate: "NOT EXECUTED",
fixtureRevision: FIXTURE_REVISION
};
const TUPLES = Object.freeze({
red: [255, 0, 0, 1],
blue: [0, 0, 255, 1],
green: [0, 128, 0, 1],
purple: [128, 0, 128, 1],
transparent: [0, 0, 0, 0]
});
const EXPECTED_IDS = Object.freeze([
"C01","C02","C03","C04","C05","C06",
"C07","C08","C09","C10","C11","C12"
]);
/*
Expected values are authored constants. They are not derived from
getComputedStyle() or from any case under test.
*/
const CASES = Object.freeze([
{
id: "C01",
property: "color",
category: "unregistered-missing",
customSource: "",
earlierRule: ".target { color: blue; }",
laterRule: ".target { color: var(--ink, red); }",
expectedName: "red"
},
{
id: "C02",
property: "color",
category: "unregistered-valid-color",
customSource: ".target { --ink: purple; }",
earlierRule: ".target { color: blue; }",
laterRule: ".target { color: var(--ink, red); }",
expectedName: "purple"
},
{
id: "C03",
property: "color",
category: "unregistered-present-wrong-for-consumer",
customSource: ".target { --ink: 16px; }",
earlierRule: ".target { color: blue; }",
laterRule: ".target { color: var(--ink, red); }",
expectedName: "green"
},
{
id: "C04",
property: "color",
category: "literal-parse-invalid-control",
customSource: "",
earlierRule: ".target { color: blue; }",
laterRule: ".target { color: 16px; }",
expectedName: "blue"
},
{
id: "C05",
property: "color",
category: "outer-present-invalid-for-consumer-nested-fallback",
customSource:
".target { --ink: 16px; --backup: blue; }",
earlierRule: ".target { color: blue; }",
laterRule:
".target { color: var(--ink, var(--backup, red)); }",
expectedName: "green"
},
{
id: "C06",
property: "color",
category: "outer-missing-nested-fallback",
customSource: ".target { --backup: blue; }",
earlierRule: ".target { color: blue; }",
laterRule:
".target { color: var(--ink, var(--backup, red)); }",
expectedName: "blue"
},
{
id: "C07",
property: "color",
category: "unregistered-explicit-empty",
customSource: ".target { --ink: ; }",
earlierRule: ".target { color: blue; }",
laterRule: ".target { color: var(--ink, red); }",
expectedName: "green"
},
{
id: "C08",
property: "color",
category: "unregistered-initial-guaranteed-invalid",
customSource: ".target { --ink: initial; }",
earlierRule: ".target { color: blue; }",
laterRule: ".target { color: var(--ink, red); }",
expectedName: "red"
},
{
id: "C09",
property: "color",
category: "unregistered-self-cycle",
customSource: ".target { --ink: var(--ink); }",
earlierRule: ".target { color: blue; }",
laterRule: ".target { color: var(--ink, red); }",
expectedName: "red"
},
{
id: "C10",
property: "background-color",
category: "non-inherited-consumer-invalid-at-computed-value",
customSource: ".target { --ink: 16px; }",
earlierRule: ".target { background-color: blue; }",
laterRule:
".target { background-color: var(--ink, red); }",
expectedName: "transparent"
},
{
id: "C11",
property: "color",
category: "registered-color-invalid-specified-value",
typed: true,
customSource: ".target { --typed-ink: 16px; }",
earlierRule: ".target { color: blue; }",
laterRule:
".target { color: var(--typed-ink, red); }",
expectedName: "purple"
},
{
id: "C12",
property: "color",
category: "registered-color-absent",
typed: true,
customSource: "",
earlierRule: ".target { color: blue; }",
laterRule:
".target { color: var(--typed-ink, red); }",
expectedName: "purple"
}
].map(c => Object.freeze({
...c,
expectedTuple: TUPLES[c.expectedName]
})));
const TYPED_REGISTRATION =
@property --typed-ink {
syntax: "<color>";
inherits: false;
initial-value: purple;
};
function sameTuple(a, b) {
return Array.isArray(a) &&
Array.isArray(b) &&
a.length === b.length &&
a.every((v, i) => v === b[i]);
}
/*
Accepted resolved-color forms are intentionally narrow.
Any other serialization is evidence requiring review.
*/
function parseResolvedColor(text) {
const s = text.trim().toLowerCase();
if (s === "transparent") return [0, 0, 0, 0];
const m = s.match(
/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(0|1|0?\.\d+))?\s*\)$/
);
if (!m) {
throw new Error("UNSUPPORTED_COLOR_SERIALIZATION: " + text);
}
const r = Number(m[1]);
const g = Number(m[2]);
const b = Number(m[3]);
const a = m[4] === undefined ? 1 : Number(m[4]);
if ([r, g, b].some(v => v < 0 || v > 255) ||
!Number.isFinite(a) || a < 0 || a > 1) {
throw new Error("OUT_OF_RANGE_COLOR_SERIALIZATION: " + text);
}
return [r, g, b, a];
}
function buildCaseDocument(c) {
const registration = c.typed ? TYPED_REGISTRATION : "";
return <!doctype html>
<meta charset="utf-8">
<style id="case-style">
${registration}
.parent { color: green; }
${c.earlierRule}
${c.laterRule}
${c.customSource}
</style>
<div class="parent">
<span id="target" class="target">target</span>
</div>;
}
function makeFrame(srcdoc, label) {
return new Promise((resolve, reject) => {
const frame = document.createElement("iframe");
frame.hidden = true;
let settled = false;
const finish = (fn, value) => {
if (settled) return;
settled = true;
clearTimeout(timer);
fn(value);
};
frame.addEventListener("load", () => {
const w = frame.contentWindow;
w.requestAnimationFrame(() => {
w.requestAnimationFrame(() => finish(resolve, frame));
});
}, { once: true });
frame.addEventListener("error", () => {
finish(reject, new Error("FRAME_ERROR: " + label));
}, { once: true });
const timer = setTimeout(() => {
finish(reject, new Error("FRAME_TIMEOUT: " + label));
}, TIMEOUT_MS);
document.body.append(frame); // connected first
frame.srcdoc = srcdoc; // handlers already installed
});
}
async function literalColorQualification() {
const srcdoc = <!doctype html><style>
#r { color:red }
#b { color:blue }
#g { color:green }
#p { color:purple }
#t { background-color:transparent }
</style>
<span id=r>x</span><span id=b>x</span>
<span id=g>x</span><span id=p>x</span><span id=t>x</span>;
const frame = await makeFrame(srcdoc, "QUAL_LITERAL_COLORS");
try {
const d = frame.contentDocument;
const values = {
red: d.defaultView.getComputedStyle(d.querySelector("#r")).color,
blue: d.defaultView.getComputedStyle(d.querySelector("#b")).color,
green: d.defaultView.getComputedStyle(d.querySelector("#g")).color,
purple: d.defaultView.getComputedStyle(d.querySelector("#p")).color,
transparent:
d.defaultView.getComputedStyle(d.querySelector("#t"))
.backgroundColor
};
const normalized = Object.fromEntries(
Object.entries(values).map(([k, v]) => [k, parseResolvedColor(v)])
);
return {
status: Object.keys(TUPLES).every(
k => sameTuple(normalized[k], TUPLES[k])
) ? "QUALIFIED" : "HOLD_EVIDENCE_OR_CAPABILITY",
forcedColors:
frame.contentWindow.matchMedia("(forced-colors: active)").matches,
raw: values,
normalized
};
} finally {
frame.remove();
}
}
async function typedQualification() {
const srcdoc = <!doctype html>
<style id="registration-style">
${TYPED_REGISTRATION}
.a, .b { color: var(--typed-ink, red); }
.b { --typed-ink: blue; }
</style>
<span id="initial" class="a">initial</span>
<span id="valid" class="b">valid</span>;
const frame = await makeFrame(srcdoc, "QUAL_TYPED");
try {
const d = frame.contentDocument;
const w = d.defaultView;
const initialString =
w.getComputedStyle(d.querySelector("#initial")).color;
const validString =
w.getComputedStyle(d.querySelector("#valid")).color;
// Copy scalar strings immediately; do not retain the live style object.
const initialTuple = parseResolvedColor(initialString);
const validTuple = parseResolvedColor(validString);
let parsedRegistration = "UNAVAILABLE";
try {
parsedRegistration = Array.from(d.styleSheets[0].cssRules)
.map(r => r.cssText)
.find(t => /^@property\s+--typed-ink/i.test(t)) ||
"NOT_FOUND";
} catch (e) {
parsedRegistration = "CSSOM_READ_ERROR: " + e.name;
}
const supportsSignals = {
customDeclaration: w.CSS.supports("--typed-ink", "blue"),
consumerDeclaration:
w.CSS.supports("color", "var(--typed-ink, red)")
};
const qualified =
sameTuple(initialTuple, TUPLES.purple) &&
sameTuple(validTuple, TUPLES.blue);
return {
status: qualified
? "QUALIFIED"
: "HOLD_EVIDENCE_OR_CAPABILITY",
initialString,
initialTuple,
validString,
validTuple,
parsedRegistration,
supportsSignals
};
} finally {
frame.remove();
}
}
async function runCase(c, qualification) {
const started = Date.now();
try {
if (c.typed && qualification.typed.status !== "QUALIFIED") {
return {
runStatus: "HOLD_EVIDENCE_OR_CAPABILITY",
caseId: c.id,
reason: "TYPED_CAPABILITY_NOT_QUALIFIED"
};
}
const frame = await makeFrame(buildCaseDocument(c), c.id);
try {
const d = frame.contentDocument;
const targets = d.querySelectorAll("#target");
if (targets.length !== 1) {
throw new Error("TARGET_COUNT_" + targets.length);
}
const target = targets[0];
const sheet = d.querySelector("#case-style").sheet;
if (!sheet) throw new Error("MISSING_CASE_STYLESHEET");
const parsedRules = Array.from(sheet.cssRules, r => r.cssText);
const style = d.defaultView.getComputedStyle(target);
// Copy scalars immediately: getComputedStyle() returns a live object.
const customString = style.getPropertyValue(
c.typed ? "--typed-ink" : "--ink"
);
const consumerString = style.getPropertyValue(c.property);
const actualTuple = parseResolvedColor(consumerString);
return {
runStatus: sameTuple(actualTuple, c.expectedTuple)
? "PASS"
: "FAIL",
caseId: c.id,
fixtureRevision: FIXTURE_REVISION,
property: c.property,
authoredValueCategory: c.category,
authoredSource: {
customSource: c.customSource,
earlierRule: c.earlierRule,
laterRule: c.laterRule
},
parsedRules,
customComputedString: customString,
consumerComputedString: consumerString,
expectedTuple: c.expectedTuple,
actualTuple,
capabilityStatus:
c.typed ? qualification.typed.status : "NOT_APPLICABLE",
elapsedMsDiagnosticOnly: Date.now() - started,
reason: null
};
} finally {
frame.remove();
}
} catch (e) {
return {
runStatus: "HOLD_EVIDENCE_OR_CAPABILITY",
caseId: c.id,
expectedTuple: c.expectedTuple,
reason: String(e && e.message || e)
};
}
}
function reconcile(rows, typedStatus) {
if (rows.length !== 12) throw new Error("ROW_COUNT");
const ids = rows.map(r => r.caseId);
if (new Set(ids).size !== 12) throw new Error("DUPLICATE_ID");
for (const id of EXPECTED_IDS) {
if (!ids.includes(id)) throw new Error("MISSING_ID_" + id);
}
for (const row of rows) {
const manifest = CASES.find(c => c.id === row.caseId);
if (!manifest) throw new Error("UNKNOWN_ID_" + row.caseId);
if (!sameTuple(row.expectedTuple, manifest.expectedTuple)) {
throw new Error("EXPECTED_VALUE_DRIFT_" + row.caseId);
}
if ((row.caseId === "C11" || row.caseId === "C12") &&
typedStatus !== "QUALIFIED") {
throw new Error("UNTYPED_QUALIFICATION_" + row.caseId);
}
if (row.runStatus !== "PASS") {
throw new Error("NON_PASS_" + row.caseId);
}
}
return "ACCEPT_EVIDENCE";
}
function reconcilerRejectionControls(goodRows) {
const clone = () => structuredClone(goodRows);
const controls = [];
function expectReject(name, mutate, typedStatus = "QUALIFIED") {
const rows = clone();
mutate(rows);
let rejected = false;
try { reconcile(rows, typedStatus); }
catch { rejected = true; }
controls.push({ name, rejected });
}
expectReject("missing-row", rows => rows.pop());
expectReject("duplicate-id", rows => { rows[11].caseId = "C01"; });
expectReject("wrong-expected-color", rows => {
rows[2].expectedTuple = TUPLES.red;
});
expectReject("unqualified-typed-case", rows => {},
"HOLD_EVIDENCE_OR_CAPABILITY");
expectReject("timeout-row", rows => {
rows[4].runStatus = "HOLD_EVIDENCE_OR_CAPABILITY";
rows[4].reason = "FRAME_TIMEOUT";
});
expectReject("parse-failure-row", rows => {
rows[6].runStatus = "HOLD_EVIDENCE_OR_CAPABILITY";
rows[6].reason = "UNSUPPORTED_COLOR_SERIALIZATION";
});
return controls;
}
async function run() {
const literal = await literalColorQualification();
if (literal.forcedColors ||
literal.status !== "QUALIFIED") {
return {
environment: RUN_ENVIRONMENT,
researchDate: RESEARCH_DATE,
researchTimezone: RESEARCH_TIMEZONE,
capability: { literal },
overall:
"HOLD_EVIDENCE_OR_CAPABILITY",
cases: []
};
}
const typed = await typedQualification();
const qualification = { literal, typed };
const rows = [];
for (const c of CASES) {
rows.push(await runCase(c, qualification));
}
let reconciliation;
try {
reconciliation = reconcile(rows, typed.status);
} catch (e) {
reconciliation =
"HOLD_EVIDENCE_OR_CAPABILITY: " + e.message;
}
return {
environment: {
...RUN_ENVIRONMENT,
userAgent:
"CAPTURE MANUALLY AND VERIFY AGAINST navigator.userAgent"
},
researchDate: RESEARCH_DATE,
researchTimezone: RESEARCH_TIMEZONE,
capability: qualification,
cases: rows,
reconciliation
};
}
/*
Intentionally not auto-executed for publication.
To perform a real run, manually record the browser's full build and
operating environment, then invoke run() from DevTools and archive
the returned object with the exact source revision.
*/
window.fixture = {
CASES,
TUPLES,
run,
reconcile,
reconcilerRejectionControls
};
document.querySelector("#out").textContent =
"Fixture loaded; NOT EXECUTED.";The execution record remains: browser build NOT RECORDED; NOT EXECUTED; operating environment NOT RECORDED; NOT EXECUTED; supplementary user-agent NOT RECORDED; NOT EXECUTED; fixture revision css-var-fallback-invalid-computed-value-validation-r1; runtime capability results NOT EXECUTED.
Declare independent expectations and environment witnesses
The complete authored manifest is:
Case | Authored differentiator | Consumer property | Independent expected result |
C01 | --ink absent | color | red [255,0,0,1] |
C02 | --ink: purple | color | purple [128,0,128,1] |
C03 | --ink: 16px | color | green [0,128,0,1] |
C04 | later literal color:16px | color | blue [0,0,255,1] |
C05 | --ink:16px; --backup:blue | color nested var() | green [0,128,0,1] |
C06 | outer missing; --backup:blue | color nested var() | blue [0,0,255,1] |
C07 | explicit --ink: ; | color | green [0,128,0,1] |
C08 | --ink: initial | color | red [255,0,0,1] |
C09 | --ink: var(--ink) | color | red [255,0,0,1] |
C10 | --ink:16px | background-color | transparent [0,0,0,0] |
C11 | registered <color>; --typed-ink:16px | color | purple [128,0,128,1] |
C12 | registered <color> absent | color | purple [128,0,128,1] |
The allowed resolved-color parser accepts only comma-form rgb()/rgba() plus literal transparent. A runtime that returns another serialization is not silently coerced to the expected result; it creates HOLD_EVIDENCE_OR_CAPABILITY. That is an evidence rule, not a claim that another serialization is invalid CSS.
Qualification probes do not consume C identifiers. They establish whether the environment can preserve the literal test colors and whether this runtime actually demonstrates the registered initial and registered valid-value paths. An affirmative CSS.supports() value alone cannot establish either witness because supports() answers a support/parsing question defined by CSS Conditional Rules rather than this end-to-end consumer-value assertion.
4. Establish missing and valid-token controls
C01 is the simplest fallback-eligibility control. No ancestor or target declares --ink. The later declaration is:
.target { color: var(--ink, red); }Because the referenced custom property has no usable value, the fallback is eligible, and the independently expected consumer tuple is red. The var() grammar defines its optional second argument as the substitute used when the referenced custom property has the guaranteed-invalid value.
C02 changes one input:
.target { --ink: purple; }Purple is a usable color, so the expected resolved consumer is purple. Red is not a competing color declaration in the cascade; it is a branch inside var() that is unnecessary once the referenced property supplies a usable substitution value.
Both controls retain the same earlier rule:
.target { color: blue; }and the same later rule:
.target { color: var(--ink, red); }The declarations are deliberately placed in separate rules with the identical selector. This avoids depending on CSSOM retention of multiple declarations with the same property in one parsed declaration block. CSSOM describes parsed declaration storage and serialization as distinct from the original authored source, so the fixture preserves authored strings separately and archives parsed rules as a second evidence field.
Each case also verifies exactly one #target and a stylesheet associated with #case-style. Those checks prevent a plausible-looking computed value from being accepted when the harness accidentally measured the wrong node or failed to install the intended stylesheet.
Keep the manifest independent of the browser output
Expected values must not be generated by asking the browser what the same declaration computes to. Doing so would compare the implementation with itself.
The fixture therefore hard-codes tuples before execution and then parses observations independently. C01’s expected red is not copied from C01. C02’s purple tuple is not learned from the case frame. The separate literal-color qualification frame checks whether the current environment makes those fixed tuple assumptions observable.
A computed custom-property string of "" is also insufficient to classify the authored state. The Custom Properties specification says the guaranteed-invalid value serializes as the empty string, while an explicitly authored empty custom property is a valid empty value rather than the guaranteed-invalid value.
That is why the ledger records both authoredValueCategory and customComputedString. C01, C07, C08, and C09 may expose diagnostic strings that are inadequate by themselves to reconstruct which source state produced them. Authored provenance supplies that distinction.
5. Supply present tokens that the consumer cannot use
C03 is the central case:
.target { color: blue; }
.target { color: var(--ink, red); }
.target { --ink: 16px; }The expected result is green, inherited from the parent.
The important sequence is that --ink exists. As an unregistered custom property, 16px is an acceptable token value, so the var() function does not choose red merely because 16px will later be unusable as a color. After substitution, the consumer effectively has a value that fails the color grammar at computed-value time. The Custom Properties specification states that ordinary properties in that state receive their inherited or initial value depending on whether they inherit by default. color inherits, so the expected result is the parent’s green.
The earlier blue declaration does not revive. The specification’s explanation is operationally important: variables cannot always fail early, and by the time the substituted value is discovered to be invalid, normal recovery to an earlier cascaded declaration is no longer available.
C04 changes the failure stage instead of merely changing a color:
.target { color: blue; }
.target { color: 16px; }Here the invalid literal declaration can be rejected by normal property parsing, leaving blue effective.
Case | Later authored form | Failure stage | Expected |
C03 | color:var(--ink,red) with --ink:16px | after substitution, computed-value validation | green |
C04 | color:16px | property-value parsing | blue |
Actual observations remain NOT EXECUTED:
Case | Expected tuple | Actual tuple | Outcome |
C03 | [0,128,0,1] | NOT EXECUTED | NOT EXECUTED |
C04 | [0,0,255,1] | NOT EXECUTED | NOT EXECUTED |
This pair is the diagnostic core of CSS invalid at computed value time. It separates “CSS custom property invalid value for this consumer” from “the declaration was syntactically invalid as that property from the start.”
6. Test the boundary of nested fallbacks
C05 asks whether adding another fallback level turns var() into value validation:
.target { --ink: 16px; --backup: blue; }
.target {
color: var(--ink, var(--backup, red));
}The independently expected result remains green.
The outer --ink exists and supplies 16px. Therefore the outer fallback expression var(--backup, red) is not selected merely because 16px later fails the color grammar. The nested fallback is not a schema validator around --ink.
C06 removes only the outer value:
.target { --backup: blue; }
.target {
color: var(--ink, var(--backup, red));
}Now the outer fallback is eligible. Its value is itself another var(). --backup exists and supplies blue, so the consumer is expected to resolve to blue. The var() specification explicitly defines recursive substitution in fallback values.
The comparison is:
Case | --ink | --backup | Expected |
C05 | 16px | blue | inherited green |
C06 | missing | blue | blue |
No new selector, origin, or priority condition is introduced.
Distinguish fallback selection from fallback usefulness
Fallback eligibility and fallback usefulness are separate questions.
First ask whether the referenced custom property is in a state that makes the fallback branch eligible. Then, if a fallback is selected, ask whether the substituted result is itself valid for color.
This article makes no broader claim that all CSS fallback functions share the same algorithm or that nested var() expressions validate arbitrary grammars. It establishes only the bounded color-token behavior declared in these cases.
That matters operationally because adding another nested fallback is an attractive but ineffective repair for C03 or C05. If --ink remains 16px, adding more alternatives behind the comma does not change the fact that the present outer value is substituted.
7. Separate empty, initial, and cyclic custom values
C07, C08, and C09 are deliberately separate documents because their source states are semantically different even when a diagnostic API might return indistinguishable-looking custom-property strings.
C07 authors an explicitly empty value:
.target { --ink: ; }
.target { color: var(--ink, red); }The Custom Properties specification explicitly says that an empty authored custom-property value is valid and is not the guaranteed-invalid value.
Accordingly, the red fallback is not selected merely because the value contains no tokens. Substituting the empty value leaves the color consumer without a valid color value, so the expected property behavior is inherited green.
C08 instead authors:
.target { --ink: initial; }For an unregistered custom property, the CSS-wide keyword participates in explicit defaulting rather than becoming the ordinary token text "initial" available to var(). The specification notes that using initial resets the custom property to the guaranteed-invalid value. The var() fallback therefore becomes eligible, producing red.
C09 authors a self-reference:
.target { --ink: var(--ink); }Custom-property dependency cycles are detected at computed-value time. The specification defines a dependency graph and states that custom properties participating in a cycle become invalid at computed-value time; the self-reference therefore makes the subsequent var(--ink, red) fallback eligible.
The expected distinction is:
Case | Source state | Fallback eligible? | Expected color |
C07 | explicit empty | no | green |
C08 | initial | yes | red |
C09 | self-cycle | yes | red |
An evidence system that collapses all three to “custom property string is empty” destroys precisely the distinction this test is supposed to preserve.
8. Check initial defaulting on a non-inherited longhand
C10 keeps the same wrong-type producer but changes the consumer:
.target { background-color: blue; }
.target { background-color: var(--ink, red); }
.target { --ink: 16px; }The expected result is transparent [0,0,0,0].
The custom property is still present, so red is still not selected as the var() fallback. The substituted 16px is invalid for background-color at computed-value time. The difference from C03 is that background-color is not an inherited property; therefore its initial value supplies the expected result rather than the parent’s green color. The Custom Properties specification uses effectively this same class of example, explaining that an invalid substituted background color resolves to the property’s initial transparent value rather than an earlier background declaration.
C10 therefore prevents a misleading generalization such as “a wrong custom value inherits from the parent.” The more precise statement is that invalid-at-computed-value-time behavior follows the consuming property’s normal inherited-versus-initial defaulting rule.
That is why every evidence row contains the consumer property’s identity. A tuple without property:"background-color" loses a critical part of the interpretation.
The word fallback is also overloaded across CSS. Refonte Learning’s article on content-visibility and intrinsic-size fallback investigates a different mechanism associated with skipped-content sizing. It does not supply authority for var() fallback eligibility, and this fixture does not import its layout measurements.
9. Compare an intentionally registered color property
C11 and C12 introduce a deliberately different token contract:
@property --typed-ink {
syntax: "<color>";
inherits: false;
initial-value: purple;
}The Properties and Values API Level 1 Working Draft of 26 March 2024 defines registered properties as having a syntax, inheritance behavior, and initial value. It also states that registration does not change ordinary cascade selection; instead, a specified registered value that violates its syntax becomes invalid at computed-value time and resets according to the registered property’s contract.
MDN documents the corresponding @property requirements: syntax and inherits are required descriptors, and a non-universal syntax requires an appropriate initial value. The initial value must be computationally independent. Literal purple satisfies that requirement because its computation does not depend on another property or a var() reference.
C11 supplies:
.target { --typed-ink: 16px; }
.target { color: var(--typed-ink, red); }Under the registered <color> contract, 16px does not become the value substituted into the consumer. The registered property itself fails its syntax at computed-value time and uses the registration’s purple initial value. The consumer therefore receives purple. The Properties and Values API specification explicitly describes the distinction between an unregistered wrong-type token and the same conceptual value under a typed registration.
C12 omits --typed-ink entirely. Because the registration supplies an initial value, the registered property has purple available; var(--typed-ink, red) therefore also expects purple rather than the red fallback. MDN’s var() reference notes that registration with an initial-value changes the missing-property situation because the registered property already has that initial value.
Case | Registered input | Expected |
C11 | invalid specified 16px | purple |
C12 | no specified value | purple |
This is not a universal recommendation to register every custom property. Registration changes the property contract: syntax, inheritance, and initial behavior are now authored API decisions.
Qualify the registration before accepting the comparison
A valid-looking @property rule in source is not enough.
The fixture requires two behavioral witnesses in an independent qualification frame:
With no specified --typed-ink, color:var(--typed-ink,red) must resolve to purple.
With --typed-ink:blue, the same consumer must resolve to blue.
It also attempts to retain the parsed @property rule from CSSOM where the runtime exposes it. If either behavior witness fails, C11 and C12 are not reinterpreted as ordinary unregistered cases. Their decision becomes HOLD_EVIDENCE_OR_CAPABILITY.
This is where CSS.supports() must stay in its lane. CSS Conditional Rules Level 3 defines the two-argument API in terms of property support and successful value parsing; the Properties and Values API specification further notes that registered custom properties still accept broad token streams at parse time and apply their typed syntax during computation. Therefore CSS.supports("--typed-ink","16px") cannot establish that a <color> registration will eventually compute the intended consumer value.
The qualification discipline is analogous only in methodology to Refonte Learning’s article on qualifying HTML pattern configuration: establish that the configuration under test actually exists before interpreting downstream behavior. Its regular-expression and form-validity mechanics are unrelated and are not imported here.
10. Capture what the browser actually resolved
The evidence record separates the declared contract from the runtime observation.
getComputedStyle() returns a live, read-only resolved-style object. MDN explicitly describes that object as live: later style changes can change values observed through the same object. CSSOM likewise distinguishes resolved-value access from authored declaration storage. The harness therefore copies scalar strings immediately rather than retaining the object as a historical snapshot.
A ledger record uses the following fields:
{
"run": {
"fixtureRevision": "css-var-fallback-invalid-computed-value-validation-r1",
"researchDate": "2026-12-02",
"researchTimezone": "Africa/Nairobi",
"testDate": "YYYY-MM-DD or NOT EXECUTED",
"browserBuild": "manual exact build or NOT RECORDED",
"operatingEnvironment": "manual exact OS/environment or NOT RECORDED",
"userAgent": "copied scalar or NOT RECORDED"
},
"capability": {
"literalColorWitness": "QUALIFIED | HOLD_EVIDENCE_OR_CAPABILITY | NOT EXECUTED",
"forcedColorsActive": "boolean | NOT EXECUTED",
"typedRegistrationWitness": "QUALIFIED | HOLD_EVIDENCE_OR_CAPABILITY | NOT EXECUTED",
"typedInitialTuple": "tuple | NOT EXECUTED",
"typedValidTuple": "tuple | NOT EXECUTED",
"parsedRegistration": "string | unavailable | NOT EXECUTED",
"supportsSignals": "object | NOT EXECUTED"
},
"case": {
"id": "C01",
"property": "color",
"authoredValueCategory": "unregistered-missing",
"authoredSource": {
"customSource": "",
"earlierRule": ".target { color: blue; }",
"laterRule": ".target { color: var(--ink, red); }"
},
"parsedDeclarations": "array | NOT EXECUTED",
"customComputedString": "string | NOT EXECUTED",
"consumerComputedString": "string | NOT EXECUTED",
"expectedTuple": [255, 0, 0, 1],
"actualTuple": "tuple | NOT EXECUTED",
"capabilityStatus": "string | NOT EXECUTED",
"outcome": "PASS | FAIL | HOLD_EVIDENCE_OR_CAPABILITY | NOT EXECUTED",
"reason": "string | null"
}
}The following two example records remain explicitly unexecuted:
{
"caseId": "C03",
"fixtureRevision": "css-var-fallback-invalid-computed-value-validation-r1",
"property": "color",
"authoredValueCategory": "unregistered-present-wrong-for-consumer",
"expectedTuple": [0, 128, 0, 1],
"parsedDeclarations": "NOT EXECUTED",
"customComputedString": "NOT EXECUTED",
"consumerComputedString": "NOT EXECUTED",
"actualTuple": "NOT EXECUTED",
"capabilityStatus": "NOT EXECUTED",
"outcome": "NOT EXECUTED",
"reason": "No browser experiment was executed for publication."
}{
"caseId": "C11",
"fixtureRevision": "css-var-fallback-invalid-computed-value-validation-r1",
"property": "color",
"authoredValueCategory": "registered-color-invalid-specified-value",
"expectedTuple": [128, 0, 128, 1],
"parsedDeclarations": "NOT EXECUTED",
"customComputedString": "NOT EXECUTED",
"consumerComputedString": "NOT EXECUTED",
"actualTuple": "NOT EXECUTED",
"capabilityStatus": "NOT EXECUTED",
"outcome": "NOT EXECUTED",
"reason": "Typed registration witnesses were not executed."
}Computed output proves the final resolved property observed under the recorded conditions. It does not, by itself, identify every originating declaration or reconstruct authored history. That boundary resembles the distinction in Refonte Learning’s article on computed fixed positioning and actual geometry: a computed-style observation and a downstream physical measurement answer different questions. This article stops at value resolution and performs no geometry experiment.
Specification publication status and runtime support are intentionally not treated as the same fact. The Properties and Values API Level 1 specification identifies itself as a Working Draft and warns that it is work in progress, while CSS Conditional Rules Level 3 identifies itself as a Candidate Recommendation Draft.
11. Reconcile all twelve cases and reject incomplete evidence
Acceptance requires the exact set C01 through C12, once each. A row count of twelve is necessary but not sufficient: twelve rows containing one duplicate and one missing ID are still incomplete.
The reconciler also verifies that each ledger row retains the expected tuple declared in the manifest. This catches a dangerous failure mode where an engineer changes an expectation after seeing the browser output and then calls the new agreement a pass.
Typed cases have another prerequisite. C11 and C12 cannot pass unless the registration qualification status is QUALIFIED. If the environment ignores registration or the witnesses do not show purple initial behavior and valid blue behavior, typed results remain held.
The fixture contains six local reconciler rejection controls, none of which is a thirteenth browser case:
Rejection control | Required result |
remove one row | reject missing inventory |
duplicate an ID | reject duplicate inventory |
change C03’s expected tuple to red | reject expectation drift |
mark typed qualification unqualified | reject C11/C12 acceptance |
mark a case as timeout | reject incomplete runtime evidence |
mark serialization parse failure | reject uninterpretable observation |
A timeout is not converted to “browser probably behaved as expected.” A frame error is not omitted. An unsupported resolved-color serialization is not normalized by guesswork. Those conditions remain visible as HOLD_EVIDENCE_OR_CAPABILITY.
Likewise, if a stylesheet cannot be read, the target count is wrong, or the case frame fails to load, the resulting row should remain in the archival record with its failure reason. A complete evidence ledger describes what happened to every declared case, including cases that could not produce a value.
The expected inventory, before any execution, is therefore twelve expected rows and twelve NOT EXECUTED actual states. No actual runtime comparison is claimed in this article.
12. Choose the repair that matches the intended value policy
The browser mechanism does not choose product policy for you. A conforming inherited green result can still be wrong for the design system.
Use this decision matrix:
Decision | Choose it when | Required action |
REPAIR_PRODUCER_VALUE | a token intended to be a color produced 16px, empty data, or another consumer-incompatible value | fix token generation/storage so the approved color value is emitted; rerun |
ADOPT_TYPED_CONTRACT | <color> syntax, chosen inherits behavior, and purple initial value are intentionally part of the token API | review and approve registration semantics; qualify runtime; rerun |
RETAIN_INTENTIONAL_DEFAULTING | inherited/initial/default behavior is explicitly desired by product and component owners | document that behavior as contract and preserve evidence |
HOLD_EVIDENCE_OR_CAPABILITY | capability witness fails, execution is incomplete, environment interferes, serialization is unsupported, or intent is unresolved | stop acceptance and gather missing evidence |
For the twelve declared cases, the default operational interpretation is:
Case | Expected path | Recommended decision |
C01 | missing token selects red fallback | RETAIN_INTENTIONAL_DEFAULTING if red is approved; otherwise hold policy |
C02 | valid purple token | RETAIN_INTENTIONAL_DEFAULTING for the established unregistered contract |
C03 | 16px reaches color consumer | REPAIR_PRODUCER_VALUE |
C04 | literal invalid declaration is parse control | HOLD_EVIDENCE_OR_CAPABILITY as a control, not a token repair case |
C05 | nested fallback does not validate 16px | REPAIR_PRODUCER_VALUE |
C06 | missing outer token reaches blue backup | RETAIN_INTENTIONAL_DEFAULTING if this default chain is approved |
C07 | present-empty token produces inherited color | REPAIR_PRODUCER_VALUE unless empty-to-inherit is explicitly contractual |
C08 | initial makes fallback red eligible | RETAIN_INTENTIONAL_DEFAULTING only if reset-to-red is intentional |
C09 | cycle makes fallback red eligible | REPAIR_PRODUCER_VALUE if the cycle is producer/configuration error |
C10 | wrong token yields transparent initial background | REPAIR_PRODUCER_VALUE unless transparent defaulting is explicitly desired |
C11 | typed invalid input becomes purple initial | ADOPT_TYPED_CONTRACT only after qualification and design-system approval |
C12 | registered absence becomes purple initial | ADOPT_TYPED_CONTRACT only after qualification and design-system approval |
The usual answer to “CSS var fallback not working” in C03 is therefore not “add another fallback.” If the producer emitted 16px for a color token by mistake, repair the producer. That expresses the intended data contract directly.
Registration is materially different. It says that the design system wants the property itself to have <color> syntax, inherits:false, and a purple initial value. The Properties and Values API specification explicitly defines those attributes as part of registered-property semantics.
Do not choose registration merely because it changes the observed result from green to purple. That would be outcome fitting, not API design.
Likewise, native CSS anchor-positioning fallbacks are placement alternatives belonging to another CSS mechanism. They are not a repair strategy for token substitution, and no anchor-positioning support claim is needed here.
Restore and revalidate the approved token revision
A repair should preserve provenance.
First retain the failed source revision and its evidence. Then either restore an approved color value at the token producer or approve a new typed-property contract as a separate design-system change. Give the repaired source its own revision identifier.
Do not overwrite C03’s failed record with the repaired observation. The first record answers what the failing revision did; the second answers whether the new revision satisfies the contract.
If restoring an older token artifact, record what was restored and why it is approved. Merely recovering old bytes proves that a restoration happened. It does not prove that those bytes encode today’s intended color.
After the change, rerun the affected repair case and the complete required C01–C12 inventory. The full inventory matters because producer changes can alter missing, empty, nested, or registration interactions even when the immediate bug report concerned only C03.
Archive the new fixture revision, manually checked browser build, operating environment, test date, qualification witnesses, parsed source evidence, copied resolved strings, normalized tuples, reconciler result, and final decision separately from the original failure.
13. Assign ownership and define revalidation triggers
A reliable token system needs ownership at the point where each contract is defined.
The token producer owner owns value generation. If a color token can emit 16px, the producer owner determines whether that is corrupt input, serialization drift, an incorrect mapping, or an intentionally polymorphic token. For this fixture’s color-only contract, an erroneous non-color value belongs there first.
The component owner owns the consuming grammar and its intended defaults. That owner decides whether the component really wants color:var(--ink,red), whether inherited green is acceptable if substitution fails at computed-value time, and whether the background control is supposed to become transparent.
The design-system owner owns registration semantics. Adopting @property is not merely defensive syntax. Choosing syntax:"<color>", inherits:false, and initial-value:purple determines behavior visible throughout every consumer of that registered name. The Properties and Values API defines all three as registration semantics, so they require design review rather than being introduced as a local patch.
The QA or validation owner owns evidence completeness. That includes the exact C01–C12 inventory, environment qualification, typed witnesses, timeout visibility, normalized tuple parsing, source revision, and reconciliation result. QA should not repair an expectation merely because the observed browser output differs.
Revalidate when a token changes value category, for example from color to length, empty, cycle-producing expression, or reset keyword. Revalidate when the consumer changes from color to another property, because inherited-versus-initial behavior belongs to the consumer’s property contract. Revalidate when registration syntax, inheritance, or initial value changes. Revalidate when the supported runtime changes in a way that affects qualification or serialization. These triggers follow directly from which inputs this fixture holds observable rather than asserting a broad compatibility ranking.
The fixture has strict limits. It covers color and one background-color control. It does not demonstrate equivalent behavior for every CSS grammar. It does not test shorthands, transitions, animations, Shadow DOM, frameworks, style injection, network loading, layout geometry, anchor positioning, accessibility conformance, or a browser-market support matrix. The Custom Properties specification even treats shorthands containing variables as a separately complicated area, which is why they are excluded here.
Nor does registration guarantee correct theming, valid producer data, or accessibility. It can enforce the declared registered syntax and supply the registered initial behavior under a qualified runtime; it cannot determine whether purple is the right brand color or whether the product owner wanted inheritance.
That is the technical endpoint of the decision: determine where the value failed, compare that browser behavior with the independently declared product color contract, and assign the repair to the owner of the contract that was actually violated.
14. Build the frontend foundations needed for reliable tokens
The maintenance discipline in this fixture depends on foundational frontend skills: reading CSS value-processing rules precisely, preserving authored source, writing small JavaScript harnesses, understanding resolved styles, and separating browser behavior from product policy.
Refonte Learning’s FrontEnd Developer Program, also described on its page as Frontend Development, currently lists HTML5/CSS3, JavaScript ES6+, responsive web design, React, Redux, APIs/AJAX, Git, advanced CSS techniques, accessibility/performance topics, and a capstone among its published competencies and program material. The page also states that successful completion can include a Training Certificate and Certificate of Internship and lists frontend, UI, and web-development career directions.
The main program-specific section states four months and 10–12 hours per week, but a conflicting three-month Frontend card has also been reported. The program-specific material names basic programming understanding, while other page language has been reported differently. Confirm the applicable duration and entry requirements with the provider. Exact var()/@property lab coverage, automation tooling, browser versions, mentoring cadence, and individual internship conditions also require confirmation.
For this article, the verified relevance is narrower: HTML/CSS and JavaScript foundations are directly useful for building reviewable browser fixtures like this one. The operational contract still comes from the CSS specifications, the authored manifest, and the evidence produced by the engineer’s own qualified runtime, rather than from a course description.
