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:
- as text content of an HTML element.
- as value of a (single- or double-) quoted attribute value.
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.
Constants
- HtmlEscapeMode ATTRIBUTE = const HtmlEscapeMode._('attribute', true, true, false, false)
-
constEscaping mode for text going into double-quoted HTML attribute values.
- HtmlEscapeMode ELEMENT = const HtmlEscapeMode._('element', true, false, false, false)
-
constEscaping mode for text going into HTML element content.
- HtmlEscapeMode SQ_ATTRIBUTE = const HtmlEscapeMode._('attribute', true, false, true, false)
-
constEscaping mode for text going into single-quoted HTML attribute values.
- HtmlEscapeMode UNKNOWN = const HtmlEscapeMode._('unknown', true, true, true, true)
-
constDefault escaping mode which escape all characters.
Properties
- bool escapeApos
-
read-onlyWhether to escape "'" (apostrophe).
- bool escapeLtGt
-
read-onlyWhether to escape '<' and '>'.
- bool escapeQuot
-
read-onlyWhether to escape '"' (quote).
- bool escapeSlash
-
read-onlyWhether to escape "/" (forward slash, solidus).