Skip to main content

selector-pseudo-class-no-unknown

禁止未知的伪类选择器。

¥Disallow unknown pseudo-class selectors.

  a:hover {}
/** ↑

* This pseudo-class selector */

该规则认为 CSS 规范中定义的伪类选择器(直到并包括编辑草稿)是已知的。

¥This rule considers pseudo-class selectors defined in the CSS Specifications, up to and including Editor's Drafts, to be known.

此规则忽略浏览器前缀的伪类选择器。

¥This rule ignores vendor-prefixed pseudo-class selectors.

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

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

选项

¥Options

true

以下模式被视为问题:

¥The following patterns are considered problems:

a:unknown {}
a:UNKNOWN {}
a:hoverr {}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a:hover {}
a:focus {}
:not(p) {}
input:-moz-placeholder {}

可选的辅助选项

¥Optional secondary options

ignorePseudoClasses: ["/regex/", /regex/, "non-regex"]

鉴于:

¥Given:

["/^--my-/", "--pseudo-class"]

以下模式不被视为问题:

¥The following patterns are not considered problems:

a:--my-pseudo {}
a:--my-other-pseudo {}
a:--pseudo-class {}