pub struct Document {
pub head: DomNode,
pub body: DomNode,
/* private fields */
}Expand description
RefCell based dom tree, tries to mimick Document as seen in browsers (https://developer.mozilla.org/en-US/docs/Web/API/Document)
using a RC Tree allows for easier manipulation of single nodes and traversing the tree
Fields§
§head: DomNode§body: DomNodeImplementations§
Source§impl Document
impl Document
pub fn from_html(html: Vec<Html>) -> Result<Self, Box<dyn Error>>
pub fn new() -> Document
pub fn root(&self) -> DomNode
pub fn sanitize(&mut self)
pub fn get_elements_by_tag_name(&self, tag: &str) -> Vec<DomNode>
pub fn get_element_by_id(&self, id: &str) -> Option<DomNode>
pub fn create_element(&self, tag: impl Into<String>) -> DomNode
pub fn create_element_with_attributes( &self, tag: impl Into<String>, attributes: HashMap<String, String>, ) -> DomNode
pub fn create_text_node(&self, text: impl Into<String>) -> DomNode
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Document
impl !RefUnwindSafe for Document
impl !Send for Document
impl !Sync for Document
impl Unpin for Document
impl !UnwindSafe for Document
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more