HtmlEscapeMode class

HTML escape modes.

HTML escape modes.

Allows specifying a mode for HTML escaping that depend on the context where the escaped result is going to be used. The relevant contexts are:

All modes require escaping of & (ampersand) characters, and may enable escaping of more characters.

Custom escape modes can be created using the HtmlEscapeMode.HtmlEscapeMode constructor.

Constructors

HtmlEscapeMode ( {String name: "custom", bool escapeLtGt: false, bool escapeQuot: false, bool escapeApos: false, bool escapeSlash: false} )
const
Create a custom escaping mode.

Constants

UNKNOWN = const HtmlEscapeMode._('unknown', true, true, true, true)
Default escaping mode which escape all characters.
ATTRIBUTE = const HtmlEscapeMode._('attribute', true, true, false, false)
Escaping mode for text going into double-quoted HTML attribute values.
SQ_ATTRIBUTE = const HtmlEscapeMode._('attribute', true, false, true, false)
Escaping mode for text going into single-quoted HTML attribute values.
ELEMENT = const HtmlEscapeMode._('element', true, false, false, false)
Escaping mode for text going into HTML element content.

Instance Properties

escapeLtGt bool
read-only
Whether to escape '<' and '>'.
escapeQuot bool
read-only
Whether to escape '"' (quote).
escapeApos bool
read-only
Whether to escape "'" (apostrophe).
escapeSlash bool
read-only
Whether to escape "/" (forward slash, solidus).

Instance Methods

toString ( ) → String
Returns a string representation of this object.