demo · v134
CSSFontFeaturesValueRule
@font-feature-values rules are reflected to script as proper CSSFontFeatureValuesRule objects. Tooling can introspect the parsed sub-rules (@styleset, @swash, etc.) instead of parsing cssText. Click "parse" — the demo creates a real stylesheet and walks the typed rule tree.
probing CSSFontFeatureValuesRule constructor...
Try it
edit the CSS and click "parse":
no parse yet
The code
const sheet = new CSSStyleSheet();
sheet.replaceSync(cssText);
for (const rule of sheet.cssRules) {
if (rule instanceof CSSFontFeatureValuesRule) {
console.log(rule.fontFamily);
console.log(rule.styleset); // typed CSSFontFeatureValuesMap
console.log(rule.swash);
}
}