Trait HtmlRenderable

Source
pub trait HtmlRenderable {
    // Required methods
    fn inner_html(&self) -> String;
    fn outer_html(&self) -> String;
    fn text_content(&self) -> String;
}

Required Methods§

Source

fn inner_html(&self) -> String

Returns the markup of all child elements

§Limitations
  • The tag attributes are written in alphabetical order
  • Spaces within the tag are not preserved (i.e. <img src=""> may become <img src="">)
  • Does no escaping to change as little as possible of the input HTML. Input has to be correctly escaped

Equivalent to Element#innerHTML in browsers

Source

fn outer_html(&self) -> String

Returns the markup building up this element an all children

§Limitations
  • The tag attributes are written in alphabetical order
  • Spaces within the tag are not preserved (i.e. <img src=""> may become <img src="">)
  • Does no escaping to change as little as possible of the input HTML. Input has to be correctly escaped

Equivalent to Element#outerHTML in browsers

Source

fn text_content(&self) -> String

Returns the contained (non-comment) text of this element, excluding any markup.

  • Does no escaping to change as little as possible of the input HTML. Input has to be correctly escaped

Equivalent to Element#outerHTML in browsers

Implementations on Foreign Types§

Source§

impl HtmlRenderable for HTMLVersion

Source§

impl HtmlRenderable for Node<HtmlContent>

Implementors§