Trait html5ever_ext::RcDomExt
[−]
[src]
pub trait RcDomExt: Sized + Minify { fn from_file_path_verified_and_stripped_of_comments_and_processing_instructions_and_with_a_sane_doc_type<P: AsRef<Path>>(
html_document_file_path: P
) -> Result<Self, HtmlError>; fn from_file_path<P: AsRef<Path>>(file_path: P) -> Result<Self, HtmlError>; fn from_bytes_verified_and_stripped_of_comments_and_processing_instructions_and_with_a_sane_doc_type<P: AsRef<Path>>(
bytes: &[u8],
context: P
) -> Result<Self, HtmlError>; fn from_bytes(bytes: &[u8]) -> Self; fn verify(&self, context: &Path) -> Result<(), HtmlError>; fn recursively_strip_nodes_of_comments_and_processing_instructions_and_create_sane_doc_type(
&self,
context: &Path
) -> Result<(), HtmlError>; fn create_html5_document(
&mut self,
unattached_node: UnattachedNode
) -> Rc<Node>; fn attach_to_document_node(
&mut self,
unattached_node: UnattachedNode
) -> Rc<Node>; fn move_node_children_to_document_node(&mut self, node: &Rc<Node>); fn move_node_to_document_node(&mut self, node: &Rc<Node>); fn append_new_element_to_document_node(
&mut self,
qualified_name: QualName,
attributes: Vec<Attribute>
) -> Rc<Node>; fn append_new_comment_to_document_node(&mut self, comment: &str); fn append_new_processing_instruction_to_document_node(
&mut self,
target: &str,
data: &str
); fn append_text_to_document_node(&mut self, text: &str); fn move_node_children_to_parent_node(
&mut self,
parent_node: &Rc<Node>,
node: &Rc<Node>
); fn move_node_to_parent_node(
&mut self,
parent_node: &Rc<Node>,
node: &Rc<Node>
); fn move_node_before_sibling_node(
&mut self,
sibling_node: &Rc<Node>,
node: &Rc<Node>
); fn append_new_element_to_parent_node(
&mut self,
parent_node: &Rc<Node>,
qualified_name: QualName,
attributes: Vec<Attribute>
) -> Rc<Node>; fn append_new_element_before_sibling_node(
&mut self,
sibling_node: &Rc<Node>,
qualified_name: QualName,
attributes: Vec<Attribute>
) -> Rc<Node>; fn append_new_comment_to_parent_node(
&mut self,
parent_node: &Rc<Node>,
comment: &str
); fn append_new_comment_before_sibling_node(
&mut self,
sibling_node: &Rc<Node>,
comment: &str
); fn append_new_processing_instruction_to_parent_node(
&mut self,
parent_node: &Rc<Node>,
target: &str,
data: &str
); fn append_new_processing_instruction_before_sibling_node(
&mut self,
sibling_node: &Rc<Node>,
target: &str,
data: &str
); fn append_text_to_parent_node(&mut self, parent_node: &Rc<Node>, text: &str); fn append_text_before_sibling_node(
&mut self,
sibling_node: &Rc<Node>,
text: &str
); }
This trait adds additional methods to a HTML DOM.
Required Methods
fn from_file_path_verified_and_stripped_of_comments_and_processing_instructions_and_with_a_sane_doc_type<P: AsRef<Path>>(
html_document_file_path: P
) -> Result<Self, HtmlError>
html_document_file_path: P
) -> Result<Self, HtmlError>
Creates an instance of an HTML DOM from a file path which is verified, stripped and with a sane DocType.
fn from_file_path<P: AsRef<Path>>(file_path: P) -> Result<Self, HtmlError>
Creates an instance of an HTML DOM from a file path
fn from_bytes_verified_and_stripped_of_comments_and_processing_instructions_and_with_a_sane_doc_type<P: AsRef<Path>>(
bytes: &[u8],
context: P
) -> Result<Self, HtmlError>
bytes: &[u8],
context: P
) -> Result<Self, HtmlError>
Creates an instance of an HTML DOM from bytes which is verified, stripped and with a sane DocType.
fn from_bytes(bytes: &[u8]) -> Self
Creates an instance of an HTML DOM from bytes
fn verify(&self, context: &Path) -> Result<(), HtmlError>
Verify that this HTML DOM is valid.
fn recursively_strip_nodes_of_comments_and_processing_instructions_and_create_sane_doc_type(
&self,
context: &Path
) -> Result<(), HtmlError>
&self,
context: &Path
) -> Result<(), HtmlError>
Remove all comments and processing instructions and make the DOCTYPE a simple 'html' (for HTML 5).
fn create_html5_document(&mut self, unattached_node: UnattachedNode) -> Rc<Node>
Adds this node preceded by a HTML5 DOCTYPE. Panics if the unattached_node is not called 'html'.
fn attach_to_document_node(
&mut self,
unattached_node: UnattachedNode
) -> Rc<Node>
&mut self,
unattached_node: UnattachedNode
) -> Rc<Node>
Attaches this node as a child of the document, ie as a root element node
fn move_node_children_to_document_node(&mut self, node: &Rc<Node>)
Moves a node's children to the document node
fn move_node_to_document_node(&mut self, node: &Rc<Node>)
Appends a new element node to the document node
fn append_new_element_to_document_node(
&mut self,
qualified_name: QualName,
attributes: Vec<Attribute>
) -> Rc<Node>
&mut self,
qualified_name: QualName,
attributes: Vec<Attribute>
) -> Rc<Node>
Appends a new element node to the document node
fn append_new_comment_to_document_node(&mut self, comment: &str)
Appends a new comment node to the document node
fn append_new_processing_instruction_to_document_node(
&mut self,
target: &str,
data: &str
)
&mut self,
target: &str,
data: &str
)
Appends a new processing instruction node to the document node
fn append_text_to_document_node(&mut self, text: &str)
Appends a text node to the document node
fn move_node_children_to_parent_node(
&mut self,
parent_node: &Rc<Node>,
node: &Rc<Node>
)
&mut self,
parent_node: &Rc<Node>,
node: &Rc<Node>
)
Moves a node's children to another parent node
fn move_node_to_parent_node(&mut self, parent_node: &Rc<Node>, node: &Rc<Node>)
Moves an existing element node to a parent node
fn move_node_before_sibling_node(
&mut self,
sibling_node: &Rc<Node>,
node: &Rc<Node>
)
&mut self,
sibling_node: &Rc<Node>,
node: &Rc<Node>
)
Moves an existing element before a sibling node
fn append_new_element_to_parent_node(
&mut self,
parent_node: &Rc<Node>,
qualified_name: QualName,
attributes: Vec<Attribute>
) -> Rc<Node>
&mut self,
parent_node: &Rc<Node>,
qualified_name: QualName,
attributes: Vec<Attribute>
) -> Rc<Node>
Appends a new element node to a parent node
fn append_new_element_before_sibling_node(
&mut self,
sibling_node: &Rc<Node>,
qualified_name: QualName,
attributes: Vec<Attribute>
) -> Rc<Node>
&mut self,
sibling_node: &Rc<Node>,
qualified_name: QualName,
attributes: Vec<Attribute>
) -> Rc<Node>
Appends a new element before a sibling node
fn append_new_comment_to_parent_node(
&mut self,
parent_node: &Rc<Node>,
comment: &str
)
&mut self,
parent_node: &Rc<Node>,
comment: &str
)
Appends a new comment node to a parent node
fn append_new_comment_before_sibling_node(
&mut self,
sibling_node: &Rc<Node>,
comment: &str
)
&mut self,
sibling_node: &Rc<Node>,
comment: &str
)
Appends a new comment before a sibling node
fn append_new_processing_instruction_to_parent_node(
&mut self,
parent_node: &Rc<Node>,
target: &str,
data: &str
)
&mut self,
parent_node: &Rc<Node>,
target: &str,
data: &str
)
Appends a new processing instruction node to a parent node
fn append_new_processing_instruction_before_sibling_node(
&mut self,
sibling_node: &Rc<Node>,
target: &str,
data: &str
)
&mut self,
sibling_node: &Rc<Node>,
target: &str,
data: &str
)
Appends a new processing instruction before a sibling node
fn append_text_to_parent_node(&mut self, parent_node: &Rc<Node>, text: &str)
Appends a text node to a parent node
fn append_text_before_sibling_node(
&mut self,
sibling_node: &Rc<Node>,
text: &str
)
&mut self,
sibling_node: &Rc<Node>,
text: &str
)
Appends a text node before a sibling node
Implementors
impl RcDomExt for RcDom