Skip to main content

selector-pseudo-element-no-unknown

禁止未知的伪元素选择器。

¥Disallow unknown pseudo-element selectors.

  a::before {}
/** ↑

* This pseudo-element selector */

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

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

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

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

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

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

选项

¥Options

true

{
"selector-pseudo-element-no-unknown": true
}

以下模式被视为问题:

¥The following patterns are considered problems:

a::pseudo {}
a::PSEUDO {}
a::element {}

以下模式不被视为问题:

¥The following patterns are not considered problems:

a:before {}
a::before {}
::selection {}
input::-moz-placeholder {}

可选的辅助选项

¥Optional secondary options

ignorePseudoElements

{ "ignorePseudoElements": ["array", "of", "pseudo-elements", "/regex/"] }

鉴于:

¥Given:

{
"selector-pseudo-element-no-unknown": [
true,
{ "ignorePseudoElements": ["/^--my-/", "--pseudo-element"] }
]
}

以下模式不被视为问题:

¥The following patterns are not considered problems:

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