pub trait HtmlRenderable {
// Required methods
fn inner_html(&self) -> String;
fn outer_html(&self) -> String;
fn text_content(&self) -> String;
}
Required Methods§
Sourcefn inner_html(&self) -> String
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
Sourcefn outer_html(&self) -> String
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
Sourcefn text_content(&self) -> String
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