You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-fonts-4] Reconcile feature-value index restrictions with prose and implementations #14657
The grammar added after #9926 restricts @styleset indexes to 0–20 and requires two @character-variant indexes, with the first limited to 0–99. But the multi-valued feature prose still says large styleset indexes parse successfully and have no rendering effect; its example uses dumb: 125.
All three engines accept the values excluded by the newer grammar:
constsheet=newCSSStyleSheet();sheet.replaceSync(`@font-feature-values Example { @styleset { a: 120 124; } @character-variant { b: 0; c: 111; d: 111 13; }}`);console.log(sheet.cssRules[0].cssText);// Chromium 151, Firefox 153, WebKit 26.5: all four declarations are retained.// Formatting and block order differ between engines.
The existing WPT parsing test also requires retaining these declarations.
We could preserve this behavior by changing the parsing requirements to:
Each @styleset declaration must match <font-feature-index [0,∞]>+.
Each @character-variant declaration must match <font-feature-index [0,∞]>{1,2}. If only one index is supplied, the feature's selected value defaults to 1.
Whether an index names an available OpenType feature is handled when applying the declaration, rather than by rejecting otherwise valid integer syntax.
This would retain the cardinality restrictions discussed in #9926 while separating syntax validity from the available OpenType feature identifiers.
Either way, the rendering prose and examples should be reconciled with whichever grammar is chosen.
I agree that there is no good reason to arbitrarily restrict these numbers, and so adjusting the spec prose to align with implementations and WPT is the correct course here.
Want to make a PR with those updated parsing requirements?
The parsing requirements now match implementations and WPT:
@styleset declarations match <font-feature-index [0,∞]>+
@character-variant declarations match <font-feature-index [0,∞]>{1,2}; if only one index is given, the value passed for the feature is 1
Whether an index names an available OpenType feature no longer affects whether the declaration is valid; it only matters when the declaration is applied
The prose and examples are updated to match, so out-of-range indexes are described as valid but enabling no feature.
Separately, 1c6be96 corrects the @swash example, which referred to ss05 and ss02 rather than swsh and cswh.
Activity
svgeesus commentedon Nov 20, 2026
I agree that there is no good reason to arbitrarily restrict these numbers, and so adjusting the spec prose to align with implementations and WPT is the correct course here.
Want to make a PR with those updated parsing requirements?
[css-fonts-4] Remove parse-time upper limits on @styleSet and @charac…
svgeesus commentedon Dec 3, 2026
Fixed in 2cae9fa. Thanks @domenic for the clear report.
The parsing requirements now match implementations and WPT:
@stylesetdeclarations match<font-feature-index [0,∞]>+@character-variantdeclarations match<font-feature-index [0,∞]>{1,2}; if only one index is given, the value passed for the feature is 1The prose and examples are updated to match, so out-of-range indexes are described as valid but enabling no feature.
Separately, 1c6be96 corrects the
@swashexample, which referred toss05andss02rather thanswshandcswh.