pub struct DocumentHtmlParser<'m, 'doc> {
pub errors: RefCell<Vec<Cow<'static, str>>>,
pub quirks_mode: Cell<QuirksMode>,
pub is_xml: bool,
/* private fields */
}Fields§
§errors: RefCell<Vec<Cow<'static, str>>>Errors that occurred during parsing.
quirks_mode: Cell<QuirksMode>The document’s quirks mode.
is_xml: boolImplementations§
Source§impl<'m, 'doc> DocumentHtmlParser<'m, 'doc>
impl<'m, 'doc> DocumentHtmlParser<'m, 'doc>
pub fn new(mutr: &'m mut DocumentMutator<'doc>) -> DocumentHtmlParser<'m, 'doc>
pub fn parse_into_mutator<'a, 'd>(mutr: &'a mut DocumentMutator<'d>, html: &str)
pub fn parse_inner_html_into_mutator<'a, 'd>( mutr: &'a mut DocumentMutator<'d>, element_id: usize, html: &str, )
Trait Implementations§
Source§impl<'m, 'doc> TreeSink for DocumentHtmlParser<'m, 'doc>
impl<'m, 'doc> TreeSink for DocumentHtmlParser<'m, 'doc>
Source§type Handle = usize
type Handle = usize
Handle is a reference to a DOM node. The tree builder requires
that a Handle implements Clone to get another reference to
the same node.type ElemName<'a> = Ref<'a, QualName> where Self: 'a
Source§fn finish(self) -> Self::Output
fn finish(self) -> Self::Output
Consume this sink and return the overall result of parsing. Read more
Source§fn parse_error(&self, msg: Cow<'static, str>)
fn parse_error(&self, msg: Cow<'static, str>)
Signal a parse error.
Source§fn get_document(&self) -> Self::Handle
fn get_document(&self) -> Self::Handle
Get a handle to the
Document node.Source§fn elem_name<'a>(&'a self, target: &'a Self::Handle) -> Self::ElemName<'a>
fn elem_name<'a>(&'a self, target: &'a Self::Handle) -> Self::ElemName<'a>
What is the name of this element? Read more
Source§fn create_element(
&self,
name: QualName,
attrs: Vec<Attribute>,
_flags: ElementFlags,
) -> Self::Handle
fn create_element( &self, name: QualName, attrs: Vec<Attribute>, _flags: ElementFlags, ) -> Self::Handle
Create an element. Read more
Source§fn create_comment(&self, _text: StrTendril) -> Self::Handle
fn create_comment(&self, _text: StrTendril) -> Self::Handle
Create a comment node.
Source§fn create_pi(&self, _target: StrTendril, _data: StrTendril) -> Self::Handle
fn create_pi(&self, _target: StrTendril, _data: StrTendril) -> Self::Handle
Create a Processing Instruction node.
Source§fn append(&self, parent_id: &Self::Handle, child: NodeOrText<Self::Handle>)
fn append(&self, parent_id: &Self::Handle, child: NodeOrText<Self::Handle>)
Append a node as the last child of the given node. If this would
produce adjacent sibling text nodes, it should concatenate the text
instead. Read more
Source§fn append_before_sibling(
&self,
sibling_id: &Self::Handle,
new_node: NodeOrText<Self::Handle>,
)
fn append_before_sibling( &self, sibling_id: &Self::Handle, new_node: NodeOrText<Self::Handle>, )
Append a node as the sibling immediately before the given node. Read more
Source§fn append_based_on_parent_node(
&self,
element: &Self::Handle,
prev_element: &Self::Handle,
child: NodeOrText<Self::Handle>,
)
fn append_based_on_parent_node( &self, element: &Self::Handle, prev_element: &Self::Handle, child: NodeOrText<Self::Handle>, )
When the insertion point is decided by the existence of a parent node of the
element, we consider both possibilities and send the element which will be used
if a parent node exists, along with the element to be used if there isn’t one.
Source§fn append_doctype_to_document(
&self,
_name: StrTendril,
_public_id: StrTendril,
_system_id: StrTendril,
)
fn append_doctype_to_document( &self, _name: StrTendril, _public_id: StrTendril, _system_id: StrTendril, )
Append a
DOCTYPE element to the Document node.Source§fn get_template_contents(&self, target: &Self::Handle) -> Self::Handle
fn get_template_contents(&self, target: &Self::Handle) -> Self::Handle
Get a handle to a template’s template contents. The tree builder
promises this will never be called with something else than
a template element.
Source§fn same_node(&self, x: &Self::Handle, y: &Self::Handle) -> bool
fn same_node(&self, x: &Self::Handle, y: &Self::Handle) -> bool
Do two handles refer to the same node?
Source§fn set_quirks_mode(&self, mode: QuirksMode)
fn set_quirks_mode(&self, mode: QuirksMode)
Set the document’s quirks mode.
Source§fn add_attrs_if_missing(&self, target: &Self::Handle, attrs: Vec<Attribute>)
fn add_attrs_if_missing(&self, target: &Self::Handle, attrs: Vec<Attribute>)
Add each attribute to the given element, if no attribute with that name
already exists. The tree builder promises this will never be called
with something else than an element.
Source§fn remove_from_parent(&self, target: &Self::Handle)
fn remove_from_parent(&self, target: &Self::Handle)
Detach the given node from its parent.
Source§fn reparent_children(
&self,
old_parent_id: &Self::Handle,
new_parent_id: &Self::Handle,
)
fn reparent_children( &self, old_parent_id: &Self::Handle, new_parent_id: &Self::Handle, )
Remove all the children from node and append them to new_parent.
Source§fn mark_script_already_started(&self, _node: &Self::Handle)
fn mark_script_already_started(&self, _node: &Self::Handle)
Mark a HTML
<script> as “already started”.Source§fn pop(&self, _node: &Self::Handle)
fn pop(&self, _node: &Self::Handle)
Indicate that a node was popped off the stack of open elements.
Source§fn associate_with_form(
&self,
_target: &Self::Handle,
_form: &Self::Handle,
_nodes: (&Self::Handle, Option<&Self::Handle>),
)
fn associate_with_form( &self, _target: &Self::Handle, _form: &Self::Handle, _nodes: (&Self::Handle, Option<&Self::Handle>), )
Associate the given form-associatable element with the form element
Source§fn is_mathml_annotation_xml_integration_point(
&self,
_handle: &Self::Handle,
) -> bool
fn is_mathml_annotation_xml_integration_point( &self, _handle: &Self::Handle, ) -> bool
Returns true if the adjusted current node is an HTML integration point
and the token is a start tag.
Source§fn set_current_line(&self, _line_number: u64)
fn set_current_line(&self, _line_number: u64)
Called whenever the line number changes.
fn allow_declarative_shadow_roots( &self, _intended_parent: &Self::Handle, ) -> bool
Auto Trait Implementations§
impl<'m, 'doc> !Freeze for DocumentHtmlParser<'m, 'doc>
impl<'m, 'doc> !RefUnwindSafe for DocumentHtmlParser<'m, 'doc>
impl<'m, 'doc> !Send for DocumentHtmlParser<'m, 'doc>
impl<'m, 'doc> !Sync for DocumentHtmlParser<'m, 'doc>
impl<'m, 'doc> Unpin for DocumentHtmlParser<'m, 'doc>
impl<'m, 'doc> !UnwindSafe for DocumentHtmlParser<'m, 'doc>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert