pub enum PseudoClass {
Show 21 variants
FirstChild,
LastChild,
NthChild(i64, i64, Option<Box<SimpleSelector>>),
NthLastChild(i64, i64, Option<Box<SimpleSelector>>),
Not(Box<SimpleSelector>),
Checked,
Disabled,
FirstOfType,
LastOfType,
NthOfType(i64, i64),
NthLastOfType(i64, i64),
OnlyOfType,
Empty,
OnlyChild,
Target,
Is(Vec<SimpleSelector>),
Where(Vec<SimpleSelector>),
Lang(String),
Dir(String),
Has(Vec<(HasCombinator, SimpleSelector)>),
Other(String),
}Variants§
FirstChild
LastChild
NthChild(i64, i64, Option<Box<SimpleSelector>>)
:nth-child(an+b) — (a, b)、1-based。第3要素は Selectors Level 4 の
:nth-child(An+B of S) 構文の S(省略時 None)。指定時は親の子要素のうち
S に一致するものだけを対象に 1-based 位置を数える。
NthLastChild(i64, i64, Option<Box<SimpleSelector>>)
:nth-last-child(an+b [of S])。
Not(Box<SimpleSelector>)
:not(simple)。
Checked
checked 属性の有無で判定(動的な操作状態ではなく DOM 属性を直接見る簡易実装)。
Disabled
disabled 属性の有無で判定。
FirstOfType
同じタグ名の兄弟の中で最初の要素。サブジェクト(末尾コンパウンド)でのみ判定可能 (祖先位置での判定は非対応。実用上ほとんどがサブジェクト用途のため許容する)。
LastOfType
NthOfType(i64, i64)
:nth-of-type(an+b) — (a, b)、同タグ名の兄弟内で1-based。
NthLastOfType(i64, i64)
:nth-last-of-type(an+b) — 同タグ名の兄弟内で末尾から1-based。
OnlyOfType
同じタグ名の兄弟が自分しかいない。
Empty
子要素・テキストを一切持たない(空白のみのテキストノードも「空」とみなす)。
OnlyChild
兄弟(タグ名問わず)が自分しかいない。
Target
現在の URL フラグメント(location.hash)が自分自身の id と一致する。
Is(Vec<SimpleSelector>)
:is(sel1, sel2, ...)(:matches()/:any() も同義)— リスト中のいずれかの
単純セレクタにマッチすれば真。特異度はリスト中の最大値を採用する。
Where(Vec<SimpleSelector>)
:where(sel1, sel2, ...) — マッチ判定は :is() と全く同じだが、特異度は常に0。
Lang(String)
:lang(code) — 要素自身の lang 属性(無ければ文書既定言語 DOCUMENT_LANG、
本来は祖先から継承されるが <html lang> のみを追跡する簡略実装)が code と
完全一致、または code- で始まるサブタグ一致(lang="en-US" は :lang(en) にも一致)。
Dir(String)
:dir(ltr|rtl) — 要素自身の dir 属性の値が一致すれば真。:lang() と同じ
簡略方針で、祖先からの継承(dir 未指定時に親の値を辿る)は非対応。dir
属性が無い/auto/不正値の要素は既定で ltr 扱いにする(この処理系のデフォルト
文書方向は常に LTR のため)。
Has(Vec<(HasCombinator, SimpleSelector)>)
:has(sel1, sel2, ...) — 各枝が子孫(任意の深さ)/直接子(> sel)/直後兄弟
(+ sel)/以降兄弟いずれか(~ sel)のいずれかに一致すれば真。
+/~ は :has() がサブジェクト位置(コンパウンドセレクタの末尾)にある場合のみ
正しく判定できる(祖先位置での of-type 判定と同じ既知の制約。type_sibling_position
参照)。複合セレクタチェーン(:has(a b) 等)は非対応で、単純セレクタ
(タグ/クラス/id/属性、および sibling_index 等の文脈を必要としない疑似クラス)
のみを対象にする。
Other(String)
Trait Implementations§
Source§impl Clone for PseudoClass
impl Clone for PseudoClass
Source§fn clone(&self) -> PseudoClass
fn clone(&self) -> PseudoClass
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PseudoClass
impl Debug for PseudoClass
Source§impl PartialEq for PseudoClass
impl PartialEq for PseudoClass
Source§fn eq(&self, other: &PseudoClass) -> bool
fn eq(&self, other: &PseudoClass) -> bool
self and other values to be equal, and is used by ==.