pub struct ElementWrapper<'a, E>
where E: TElement,
{ element: E, cached_snapshot: Cell<Option<&'a Snapshot>>, snapshot_map: &'a SnapshotMap, }
Expand description

A simple wrapper over an element and a snapshot, that allows us to selector-match against a past state of the element.

Fields§

§element: E§cached_snapshot: Cell<Option<&'a Snapshot>>§snapshot_map: &'a SnapshotMap

Implementations§

source§

impl<'a, E> ElementWrapper<'a, E>
where E: TElement,

source

pub fn new(el: E, snapshot_map: &'a SnapshotMap) -> Self

Trivially constructs an ElementWrapper.

source

pub fn snapshot(&self) -> Option<&'a Snapshot>

Gets the snapshot associated with this element, if any.

source

pub fn state_changes(&self) -> ElementState

Returns the states that have changed since the element was snapshotted.

source

fn get_lang(&self) -> Option<AttrValue>

Returns the value of the xml:lang="" (or, if appropriate, lang="") attribute from this element’s snapshot or the closest ancestor element snapshot with the attribute specified.

Trait Implementations§

source§

impl<'a, E> Clone for ElementWrapper<'a, E>
where E: TElement + Clone,

source§

fn clone(&self) -> ElementWrapper<'a, E>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'a, E> Debug for ElementWrapper<'a, E>
where E: TElement,

source§

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

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

impl<'a, E> Element for ElementWrapper<'a, E>
where E: TElement,

source§

type Impl = SelectorImpl

source§

fn match_non_ts_pseudo_class( &self, pseudo_class: &NonTSPseudoClass, context: &mut MatchingContext<'_, Self::Impl>, ) -> bool

source§

fn apply_selector_flags(&self, _flags: ElementSelectorFlags)

Sets selector flags on the elemnt itself or the parent, depending on the flags, which indicate what kind of work may need to be performed when DOM state changes.
source§

fn match_pseudo_element( &self, pseudo_element: &PseudoElement, context: &mut MatchingContext<'_, Self::Impl>, ) -> bool

Whether this element is a link.
source§

fn opaque(&self) -> OpaqueElement

Converts self into an opaque representation.
source§

fn parent_element(&self) -> Option<Self>

source§

fn parent_node_is_shadow_root(&self) -> bool

Whether the parent node of this element is a shadow root.
source§

fn containing_shadow_host(&self) -> Option<Self>

The host of the containing shadow root, if any.
source§

fn prev_sibling_element(&self) -> Option<Self>

Skips non-element nodes
source§

fn next_sibling_element(&self) -> Option<Self>

Skips non-element nodes
source§

fn first_element_child(&self) -> Option<Self>

Skips non-element nodes
source§

fn is_html_element_in_html_document(&self) -> bool

source§

fn is_html_slot_element(&self) -> bool

Returns whether the element is an HTML element.
source§

fn has_local_name( &self, local_name: &<Self::Impl as SelectorImpl>::BorrowedLocalName, ) -> bool

source§

fn has_namespace( &self, ns: &<Self::Impl as SelectorImpl>::BorrowedNamespaceUrl, ) -> bool

Empty string for no namespace
source§

fn is_same_type(&self, other: &Self) -> bool

Whether this element and the other element have the same local name and namespace.
source§

fn attr_matches( &self, ns: &NamespaceConstraint<&Namespace>, local_name: &LocalName, operation: &AttrSelectorOperation<&AttrValue>, ) -> bool

source§

fn has_id(&self, id: &AtomIdent, case_sensitivity: CaseSensitivity) -> bool

source§

fn is_part(&self, name: &AtomIdent) -> bool

source§

fn imported_part(&self, name: &AtomIdent) -> Option<AtomIdent>

Returns the mapping from the exportparts attribute in the reverse direction, that is, in an outer-tree -> inner-tree direction.
source§

fn has_class(&self, name: &AtomIdent, case_sensitivity: CaseSensitivity) -> bool

source§

fn has_custom_state(&self, state: &AtomIdent) -> bool

source§

fn is_empty(&self) -> bool

Returns whether this element matches :empty. Read more
source§

fn is_root(&self) -> bool

Returns whether this element matches :root, i.e. whether it is the root element of a document. Read more
source§

fn is_pseudo_element(&self) -> bool

Whether we’re matching on a pseudo-element.
source§

fn pseudo_element_originating_element(&self) -> Option<Self>

The parent of a given pseudo-element, after matching a pseudo-element selector. Read more
source§

fn assigned_slot(&self) -> Option<Self>

Returns the assigned element this element is assigned to. Read more
source§

fn add_element_unique_hashes(&self, _filter: &mut BloomFilter) -> bool

Add hashes unique to this element to the given filter, returning true if any got added.
source§

fn has_attr_in_no_namespace( &self, local_name: &<Self::Impl as SelectorImpl>::LocalName, ) -> bool

source§

fn ignores_nth_child_selectors(&self) -> bool

Returns whether this element should ignore matching nth child selector.

Auto Trait Implementations§

§

impl<'a, E> !Freeze for ElementWrapper<'a, E>

§

impl<'a, E> !RefUnwindSafe for ElementWrapper<'a, E>

§

impl<'a, E> Send for ElementWrapper<'a, E>
where E: Send,

§

impl<'a, E> !Sync for ElementWrapper<'a, E>

§

impl<'a, E> Unpin for ElementWrapper<'a, E>
where E: Unpin,

§

impl<'a, E> !UnwindSafe for ElementWrapper<'a, E>

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> MaybeBoxed<Box<T>> for T

source§

fn maybe_boxed(self) -> Box<T>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T