css-selector-parser / Exports / AstFormulaOfSelector
Pseudo-class formula of selector value. a
is multiplier of n
and b
us added on top. Formula: an + b
.
Formula is followed by of
keyword and then goes a CSS selector.
For instance :nth-child(2n + 1 of div)
->
{type: 'AstPseudoClass'..., argument: {type: 'FormulaOfSelector', a: 2, b: 1, selector: {type: 'Selector', rules: [{type: 'Rule', items: [{type: 'TagName', name: 'div'}]}]}}}
.
Generated by ast.formulaOfSelector.
See
https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child#functional_notation
• a: number
Multiplier of n
.
• b: number
Constant added to a*n
.
• selector: AstRule
Selector that goes after formula (i.e. "div -> span"
in case of ":nth-child(2n + 1 of div > span)"
• type: "FormulaOfSelector"