Skip to main content

Node

Struct Node 

Source
pub struct Node<'a> { /* private fields */ }
Expand description

DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type.

Implementations§

Source§

impl<'a> Node<'a>

Source

pub fn builder( node_id: NodeId, backend_node_id: BackendNodeId, node_type: i64, node_name: impl Into<Cow<'a, str>>, local_name: impl Into<Cow<'a, str>>, node_value: impl Into<Cow<'a, str>>, ) -> NodeBuilder<'a>

Creates a builder for this type with the required parameters:

  • node_id: Node identifier that is passed into the rest of the DOM messages as the nodeId. Backend will only push node with given id once. It is aware of all requested nodes and will only fire DOM events for nodes known to the client.
  • backend_node_id: The BackendNodeId for this node.
  • node_type: Node’s nodeType.
  • node_name: Node’s nodeName.
  • local_name: Node’s localName.
  • node_value: Node’s nodeValue.
Source

pub fn node_id(&self) -> &NodeId

Node identifier that is passed into the rest of the DOM messages as the ‘nodeId’. Backend will only push node with given ‘id’ once. It is aware of all requested nodes and will only fire DOM events for nodes known to the client.

Source

pub fn parent_id(&self) -> Option<&NodeId>

The id of the parent node if any.

Source

pub fn backend_node_id(&self) -> &BackendNodeId

The BackendNodeId for this node.

Source

pub fn node_type(&self) -> i64

‘Node’’s nodeType.

Source

pub fn node_name(&self) -> &str

‘Node’’s nodeName.

Source

pub fn local_name(&self) -> &str

‘Node’’s localName.

Source

pub fn node_value(&self) -> &str

‘Node’’s nodeValue.

Source

pub fn child_node_count(&self) -> Option<u64>

Child count for ‘Container’ nodes.

Source

pub fn children(&self) -> Option<&[Box<Node<'a>>]>

Child nodes of this node when requested with children.

Source

pub fn attributes(&self) -> Option<&[Cow<'a, str>]>

Attributes of the ‘Element’ node in the form of flat array ‘[name1, value1, name2, value2]’.

Source

pub fn document_url(&self) -> Option<&str>

Document URL that ‘Document’ or ‘FrameOwner’ node points to.

Source

pub fn base_url(&self) -> Option<&str>

Base URL that ‘Document’ or ‘FrameOwner’ node uses for URL completion.

Source

pub fn public_id(&self) -> Option<&str>

‘DocumentType’’s publicId.

Source

pub fn system_id(&self) -> Option<&str>

‘DocumentType’’s systemId.

Source

pub fn internal_subset(&self) -> Option<&str>

‘DocumentType’’s internalSubset.

Source

pub fn xml_version(&self) -> Option<&str>

‘Document’’s XML version in case of XML documents.

Source

pub fn name(&self) -> Option<&str>

‘Attr’’s name.

Source

pub fn value(&self) -> Option<&str>

‘Attr’’s value.

Source

pub fn pseudo_type(&self) -> Option<&PseudoType>

Pseudo element type for this node.

Source

pub fn pseudo_identifier(&self) -> Option<&str>

Pseudo element identifier for this node. Only present if there is a valid pseudoType.

Source

pub fn shadow_root_type(&self) -> Option<&ShadowRootType>

Shadow root type.

Source

pub fn frame_id(&self) -> Option<&FrameId<'a>>

Frame ID for frame owner elements.

Source

pub fn content_document(&self) -> Option<&Node<'a>>

Content document for frame owner elements.

Source

pub fn shadow_roots(&self) -> Option<&[Box<Node<'a>>]>

Shadow root list for given element host.

Source

pub fn template_content(&self) -> Option<&Node<'a>>

Content document fragment for template elements.

Source

pub fn pseudo_elements(&self) -> Option<&[Box<Node<'a>>]>

Pseudo elements associated with this node.

Source

pub fn imported_document(&self) -> Option<&Node<'a>>

Deprecated, as the HTML Imports API has been removed (crbug.com/937746). This property used to return the imported document for the HTMLImport links. The property is always undefined now.

Source

pub fn distributed_nodes(&self) -> Option<&[BackendNode<'a>]>

Distributed nodes for given insertion point.

Source

pub fn is_svg(&self) -> Option<bool>

Whether the node is SVG.

Source

pub fn compatibility_mode(&self) -> Option<&CompatibilityMode>

Source

pub fn assigned_slot(&self) -> Option<&BackendNode<'a>>

Source

pub fn is_scrollable(&self) -> Option<bool>

Source

pub fn affected_by_starting_styles(&self) -> Option<bool>

Source

pub fn adopted_style_sheets(&self) -> Option<&[StyleSheetId<'a>]>

Source

pub fn ad_provenance(&self) -> Option<&AdProvenance<'a>>

Trait Implementations§

Source§

impl<'a> Clone for Node<'a>

Source§

fn clone(&self) -> Node<'a>

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<'a> Debug for Node<'a>

Source§

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

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

impl<'a> Default for Node<'a>

Source§

fn default() -> Node<'a>

Returns the “default value” for a type. Read more
Source§

impl<'de, 'a> Deserialize<'de> for Node<'a>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'a> Serialize for Node<'a>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Node<'a>

§

impl<'a> RefUnwindSafe for Node<'a>

§

impl<'a> Send for Node<'a>

§

impl<'a> Sync for Node<'a>

§

impl<'a> Unpin for Node<'a>

§

impl<'a> UnsafeUnpin for Node<'a>

§

impl<'a> UnwindSafe for Node<'a>

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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,