Type Alias script::dom::bindings::root::DomRoot

source ·
pub type DomRoot<T> = Root<Dom<T>>;
Expand description

A rooted reference to a DOM object.

Aliased Type§

struct DomRoot<T> {
    value: Dom<T>,
    root_list: *const RootCollection,
}

Fields§

§value: Dom<T>

The value to root.

§root_list: *const RootCollection

List that ensures correct dynamic root ordering

Implementations§

source§

impl<T> Root<T>where T: StableTraceObject + 'static,

source

pub unsafe fn new(value: T) -> Self

Create a new stack-bounded root for the provided value. It cannot outlive its associated RootCollection, and it gives out references which cannot outlive this new Root.

source§

impl<T: Castable> Root<Dom<T>>

source

pub fn upcast<U>(root: Root<Dom<T>>) -> Root<Dom<U>>where U: Castable, T: DerivedFrom<U>,

Cast a DOM object root upwards to one of the interfaces it derives from.

source

pub fn downcast<U>(root: Root<Dom<T>>) -> Option<Root<Dom<U>>>where U: DerivedFrom<T>,

Cast a DOM object root downwards to one of the interfaces it might implement.

source§

impl<T: DomObject> Root<Dom<T>>

source

pub fn from_ref(unrooted: &T) -> Root<Dom<T>>

Generate a new root from a reference

Trait Implementations§

source§

impl<T> Clone for Root<Dom<T>>where T: DomObject,

source§

fn clone(&self) -> Root<Dom<T>>

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 Debug for Root<Dom<Element>>

source§

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

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

impl<T> Deref for Root<T>where T: Deref + StableTraceObject,

§

type Target = <T as Deref>::Target

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T> Drop for Root<T>where T: StableTraceObject,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Element for Root<Dom<Element>>

§

type Impl = SelectorImpl

source§

fn opaque(&self) -> OpaqueElement

Converts self into an opaque representation.
source§

fn parent_element(&self) -> Option<Root<Dom<Element>>>

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 is_pseudo_element(&self) -> bool

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

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

source§

fn prev_sibling_element(&self) -> Option<Root<Dom<Element>>>

Skips non-element nodes
source§

fn next_sibling_element(&self) -> Option<Root<Dom<Element>>>

Skips non-element nodes
source§

fn first_element_child(&self) -> Option<Root<Dom<Element>>>

Skips non-element nodes
source§

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

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_empty(&self) -> bool

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

fn has_local_name(&self, local_name: &LocalName) -> bool

source§

fn has_namespace(&self, ns: &Namespace) -> 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 match_non_ts_pseudo_class( &self, pseudo_class: &NonTSPseudoClass, _: &mut MatchingContext<'_, Self::Impl> ) -> bool

Whether this element is a link.
source§

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

source§

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

source§

fn imported_part(&self, _: &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 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 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 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_custom_state(&self, _name: &AtomIdent) -> bool

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 has_attr_in_no_namespace( &self, local_name: &<Self::Impl as SelectorImpl>::LocalName ) -> bool

source§

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

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

fn ignores_nth_child_selectors(&self) -> bool

Returns whether this element should ignore matching nth child selector.
source§

impl<T: DomObject + IDLInterface> FromJSValConvertible for Root<Dom<T>>

§

type Config = ()

Optional configurable behaviour switch; use () for no configuration.
source§

unsafe fn from_jsval( cx: *mut JSContext, value: HandleValue<'_>, _config: Self::Config ) -> Result<ConversionResult<Root<Dom<T>>>, ()>

Convert val to type Self. Optional configuration of type T can be passed as the option argument. If it returns Err(()), a JSAPI exception is pending. If it returns Ok(Failure(reason)), there is no pending JSAPI exception.
source§

impl Hash for Root<Dom<GPUBuffer>>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T> MallocSizeOf for Root<Dom<T>>where T: DomObject + MallocSizeOf,

source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.
source§

impl<T> PartialEq<Root<Dom<T>>> for Root<Dom<T>>where T: DomObject,

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: DomObject> ToJSValConvertible for Root<Dom<T>>

source§

unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue<'_>)

Convert self to a JSVal. JSAPI failure causes a panic.
source§

impl<T> Traceable for Root<Dom<T>>where T: DomObject,

source§

unsafe fn trace(&self, _: *mut JSTracer)

Trace self.
source§

impl Eq for Root<Dom<GPUBuffer>>