[][src]Enum lol_html::html_content::TextType

pub enum TextType {
    PlainText,
    RCData,
    RawText,
    ScriptData,
    Data,
    CDataSection,
}

A type of parsed text.

Parsing context adds certain limitations for the textual content. E.g., it's unsafe to rewrite text inside <script> element with a string that contains "</script>" substring as this will preemptively close the <script> element, possibly introducing an XSS attack vector. As other example, some parsing contexts don't allow HTML entities in text. Thus, rewriting content of a <style> element with text that contains HTML entities may cause a CSS parsing error in a browser, because entities won't be decoded by a browser in this context.

Text type provides users of the rewriter with a capability to assess the context in which text parsing is hapenning and make informed decision about preprocessing of the textual content replacement.

The names of the text types are taken from the HTML parsing specification.

Variants

PlainText

Text inside a <plaintext> element.

RCData

Text inside <title> and <textarea> elements.

RawText

Text inside <style>, <xmp>, <iframe>, <noembed>, <noframes> and <noscript> elements.

ScriptData

Text inside a <script> element.

Data

Regular text.

CDataSection

Text inside a CDATA section.

Methods

impl TextType[src]

Trait Implementations

impl Clone for TextType[src]

impl Copy for TextType[src]

impl Debug for TextType[src]

impl PartialEq<TextType> for TextType[src]

impl StructuralPartialEq for TextType[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.