Skip to main content

PseudoClass

Enum PseudoClass 

Source
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

Source§

fn clone(&self) -> PseudoClass

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PseudoClass

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for PseudoClass

Source§

fn eq(&self, other: &PseudoClass) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for PseudoClass

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.