DocumentHtmlParser

Struct DocumentHtmlParser 

Source
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: bool

Implementations§

Source§

impl<'m, 'doc> DocumentHtmlParser<'m, 'doc>

Source

pub fn new(mutr: &'m mut DocumentMutator<'doc>) -> DocumentHtmlParser<'m, 'doc>

Source

pub fn parse_into_mutator<'a, 'd>(mutr: &'a mut DocumentMutator<'d>, html: &str)

Source

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>

Source§

type Output = ()

The overall result of parsing. Read more
Source§

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.
Source§

type ElemName<'a> = Ref<'a, QualName> where DocumentHtmlParser<'m, 'doc>: 'a

Source§

fn finish(self) -> <DocumentHtmlParser<'m, 'doc> as TreeSink>::Output

Consume this sink and return the overall result of parsing. Read more
Source§

fn parse_error(&self, msg: Cow<'static, str>)

Signal a parse error.
Source§

fn get_document(&self) -> <DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle

Get a handle to the Document node.
Source§

fn elem_name<'a>( &'a self, target: &'a <DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle, ) -> <DocumentHtmlParser<'m, 'doc> as TreeSink>::ElemName<'a>

What is the name of this element? Read more
Source§

fn create_element( &self, name: QualName, attrs: Vec<Attribute>, _flags: ElementFlags, ) -> <DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle

Create an element. Read more
Source§

fn create_comment( &self, _text: Tendril<UTF8>, ) -> <DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle

Create a comment node.
Source§

fn create_pi( &self, _target: Tendril<UTF8>, _data: Tendril<UTF8>, ) -> <DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle

Create a Processing Instruction node.
Source§

fn append( &self, parent_id: &<DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle, child: NodeOrText<<DocumentHtmlParser<'m, 'doc> as TreeSink>::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: &<DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle, new_node: NodeOrText<<DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle>, )

Append a node as the sibling immediately before the given node. Read more
Source§

fn append_based_on_parent_node( &self, element: &<DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle, prev_element: &<DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle, child: NodeOrText<<DocumentHtmlParser<'m, 'doc> as TreeSink>::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: Tendril<UTF8>, _public_id: Tendril<UTF8>, _system_id: Tendril<UTF8>, )

Append a DOCTYPE element to the Document node.
Source§

fn get_template_contents( &self, target: &<DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle, ) -> <DocumentHtmlParser<'m, 'doc> as TreeSink>::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: &<DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle, y: &<DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle, ) -> bool

Do two handles refer to the same node?
Source§

fn set_quirks_mode(&self, mode: QuirksMode)

Set the document’s quirks mode.
Source§

fn add_attrs_if_missing( &self, target: &<DocumentHtmlParser<'m, 'doc> as TreeSink>::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: &<DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle, )

Detach the given node from its parent.
Source§

fn reparent_children( &self, old_parent_id: &<DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle, new_parent_id: &<DocumentHtmlParser<'m, 'doc> as TreeSink>::Handle, )

Remove all the children from node and append them to new_parent.
Source§

fn mark_script_already_started(&self, _node: &Self::Handle)

Mark a HTML <script> as “already started”.
Source§

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>), )

Associate the given form-associatable element with the form element
Source§

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)

Called whenever the line number changes.
Source§

fn allow_declarative_shadow_roots( &self, _intended_parent: &Self::Handle, ) -> bool

Source§

fn attach_declarative_shadow( &self, _location: &Self::Handle, _template: &Self::Handle, _attrs: &[Attribute], ) -> bool

Attempt to attach a declarative shadow root at the given location. Read more

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> 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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,