Calculate the specificity of a single CSS selector.
The specificity of the selector.
The selector is invalid.
This is based on https://www.w3.org/TR/css3-selectors/#specificity
A larger number represents a more specific selector.
The smallest possible specificity is 0.
0
The result is represented as a hex number 0x<aa><bb><cc> where each component is the count of the respective selector clause.
0x<aa><bb><cc>
If the selector contains commas, only the first clause is used.
The computed result is cached, so subsequent calculations for the same selector are extremely fast.
The CSS selector of interest.
Generated using TypeDoc
Calculate the specificity of a single CSS selector.
Returns
The specificity of the selector.
Undefined Behavior
The selector is invalid.
Notes
This is based on https://www.w3.org/TR/css3-selectors/#specificity
A larger number represents a more specific selector.
The smallest possible specificity is
0.The result is represented as a hex number
0x<aa><bb><cc>where each component is the count of the respective selector clause.If the selector contains commas, only the first clause is used.
The computed result is cached, so subsequent calculations for the same selector are extremely fast.