Specificity class

CSS selector specificity as a triple (a, b, c):

  • a — ID selectors
  • b — class, attribute and pseudo-class selectors
  • c — type selectors and pseudo-elements

Compared lexicographically, a before b before c.

Implemented types

Constructors

Specificity(int a, int b, int c)
Creates a specificity triple.
const

Properties

a int
The ID-selector count.
final
b int
The class/attribute/pseudo-class count.
final
c int
The type-selector/pseudo-element count.
final
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

compareTo(Specificity other) int
Compares this object to another object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator +(Specificity other) Specificity
Component-wise addition.
operator <(Specificity other) bool
Whether this specificity is lower than other.
operator <=(Specificity other) bool
Whether this specificity is at most other.
operator ==(Object other) bool
The equality operator.
override
operator >(Specificity other) bool
Whether this specificity is higher than other.
operator >=(Specificity other) bool
Whether this specificity is at least other.

Constants

classSelector → const Specificity
The specificity of a class, attribute or pseudo-class, (0,1,0).
idSelector → const Specificity
The specificity of an ID selector, (1,0,0).
typeSelector → const Specificity
The specificity of a type selector or pseudo-element, (0,0,1).
universal → const Specificity
Zero specificity. Prefer zero.
zero → const Specificity
Zero specificity, contributed by :where() and the universal selector.