selector-max-pseudo-class
限制选择器中伪类的数量。
¥Limit the number of pseudo-classes in a selector.
.foo .bar:first-child:hover {}
/* ↑ ↑
↑ ↑
1 2 -- this selector contains two pseudo-classes */
此规则在计算选择器中伪类的数量之前解析嵌套选择器。选择器列表 中的每个选择器都是单独评估的。
¥This rule resolves nested selectors before counting the number of pseudo-classes in a selector. Each selector in a selector list is evaluated separately.
:not()
伪类的内容也单独评估。该规则将参数视为独立选择器,并且结果不计入整个选择器的总数。
¥The content of the :not()
pseudo-class is also evaluated separately. The rule processes the argument as if it were an independent selector, and the result does not count toward the total for the entire selector.
message
次要选项 可以接受该规则的参数。
¥The message
secondary option can accept the arguments of this rule.
选项
¥Options
int
:允许的最大伪类。
¥int
: Maximum pseudo-classes allowed.
例如,对于 1
:
¥For example, with 1
:
以下模式被视为问题:
¥The following patterns are considered problems:
a:first-child:focus {}
.foo .bar:first-child:hover {}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {}
a:first-child {}
.foo .bar:first-child {}