Skip to main content

Document

Struct Document 

Source
pub struct Document {
    pub html: DomNode,
    pub head: DomNode,
    pub body: DomNode,
    pub title: Rc<RefCell<String>>,
    pub mutated: Rc<RefCell<bool>>,
    pub mutation_sink: Rc<RefCell<MutationSink>>,
}
Expand description

W3C-compliant document node container holding root, head, body, and DOM elements.

Fields§

§html: DomNode§head: DomNode§body: DomNode§title: Rc<RefCell<String>>§mutated: Rc<RefCell<bool>>§mutation_sink: Rc<RefCell<MutationSink>>

Implementations§

Source§

impl Document

Source

pub fn new() -> Self

Source

pub fn mark_mutated(&self)

Source

pub fn has_mutated(&self) -> bool

Source

pub fn clear_mutated(&self)

Source

pub fn add_mutation_listener<F>(&self, listener: F)
where F: FnMut(&DomMutationRecord) + 'static,

Source

pub fn set_mutation_channel(&self, sender: Sender<DomMutationRecord>)

Source

pub fn drain_mutations(&self) -> Vec<DomMutationRecord>

Source

pub fn pending_mutations(&self) -> Vec<DomMutationRecord>

Source

pub fn from_html(html_str: &str) -> Self

Source

pub fn create_element(&self, tag: &str) -> DomNode

Source

pub fn create_text_node(&self, text: &str) -> DomNode

Source

pub fn create_comment(&self, comment: &str) -> DomNode

Source

pub fn get_element_by_id(&self, id: &str) -> Option<DomNode>

Source

pub fn get_element_by_uid(&self, uid: u64) -> Option<DomNode>

Source

pub fn query_selector(&self, selector: &str) -> Option<DomNode>

Source

pub fn query_selector_all(&self, selector: &str) -> Vec<DomNode>

Source

pub fn to_html(&self) -> String

Trait Implementations§

Source§

impl Clone for Document

Source§

fn clone(&self) -> Self

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 Default for Document

Source§

fn default() -> Self

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

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.