/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Traits that nodes must implement. Breaks the otherwise-cyclic dependency //! between layout and style.
usecrate::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint}; usecrate::bloom::BloomFilter; usecrate::matching::{ElementSelectorFlags, MatchingContext}; usecrate::parser::SelectorImpl; use std::fmt::Debug; use std::ptr::NonNull;
/// Opaque representation of an Element, for identity comparisons. #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pubstruct OpaqueElement(NonNull<()>);
unsafeimpl Send for OpaqueElement {} // This should be safe given that we do not provide a way to recover // the original reference. unsafeimpl Sync for OpaqueElement {}
impl OpaqueElement { /// Creates a new OpaqueElement from an arbitrarily-typed pointer. pubfn new<T>(ptr: &T) -> Self { unsafe {
OpaqueElement(NonNull::new_unchecked(
ptr as *const T as *const () as *mut (),
))
}
}
/// Creates a new OpaqueElement from a type-erased non-null pointer pubfn from_non_null_ptr(ptr: NonNull<()>) -> Self { Self(ptr)
}
/// Returns a const ptr to the contained reference. Unsafe especially /// since Element can be recovered and potentially-mutated. pubunsafefn as_const_ptr<T>(&self) -> *const T { self.0.as_ptr() as *const T
}
}
/// Converts self into an opaque representation. fn opaque(&self) -> OpaqueElement;
fn parent_element(&self) -> Option<Self>;
/// Whether the parent node of this element is a shadow root. fn parent_node_is_shadow_root(&self) -> bool;
/// The host of the containing shadow root, if any. fn containing_shadow_host(&self) -> Option<Self>;
/// The parent of a given pseudo-element, after matching a pseudo-element /// selector. /// /// This is guaranteed to be called in a pseudo-element. fn pseudo_element_originating_element(&self) -> Option<Self> {
debug_assert!(self.is_pseudo_element()); self.parent_element()
}
/// Whether we're matching on a pseudo-element. fn is_pseudo_element(&self) -> bool;
/// 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. fn apply_selector_flags(&self, flags: ElementSelectorFlags);
/// Whether this element is a `link`. fn is_link(&self) -> bool;
/// Returns whether the element is an HTML <slot> element. fn is_html_slot_element(&self) -> bool;
/// Returns the assigned <slot> element this element is assigned to. /// /// Necessary for the `::slotted` pseudo-class. fn assigned_slot(&self) -> Option<Self> {
None
}
/// Returns the mapping from the `exportparts` attribute in the reverse /// direction, that is, in an outer-tree -> inner-tree direction. fn imported_part(
&self,
name: &<Self::Implas SelectorImpl>::Identifier,
) -> Option<<Self::Implas SelectorImpl>::Identifier>;
/// Returns whether this element matches `:empty`. /// /// That is, whether it does not contain any child element or any non-zero-length text node. /// See http://dev.w3.org/csswg/selectors-3/#empty-pseudo fn is_empty(&self) -> bool;
/// Returns whether this element matches `:root`, /// i.e. whether it is the root element of a document. /// /// Note: this can be false even if `.parent_element()` is `None` /// if the parent node is a `DocumentFragment`. fn is_root(&self) -> bool;
/// Returns whether this element should ignore matching nth child /// selector. fn ignores_nth_child_selectors(&self) -> bool { false
}
/// Add hashes unique to this element to the given filter, returning true /// if any got added. fn add_element_unique_hashes(&self, filter: &mut BloomFilter) -> bool;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.21 Sekunden
(vorverarbeitet am 2026-06-18)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.