Skip to main content

selector-max-combinators

限制选择器中组合器的数量。

¥Limit the number of combinators in a selector.

  a > b + c ~ d e { color: pink; }
/** ↑ ↑ ↑ ↑

* These are combinators */

此规则在计算组合器选择器的数量之前解析嵌套选择器。选择器列表 中的每个选择器都是单独评估的。

¥This rule resolves nested selectors before counting the number of combinators selectors. Each selector in a selector list is evaluated separately.

message 次要选项 可以接受该规则的参数。

¥The message secondary option can accept the arguments of this rule.

选项

¥Options

int:允许的最大组合选择器。

¥int: Maximum combinators selectors allowed.

例如,对于 2

¥For example, with 2:

以下模式被视为问题:

¥The following patterns are considered problems:

a b ~ c + d {}
a b ~ c {
& > d {}
}
a b {
& ~ c {
& + d {}
}
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a {}
a b {}
a b ~ c {}
a b {
& ~ c {}
}
/* each selector in a selector list is evaluated separately */
a b,
c > d {}