HEsc class abstract
HTML escaping methods for escaping values for output in HTML.
These methods are provided to help generate HTML from arbitrary strings and other objects.
Use attr to escape values to be used in attributes.
Use text to escape values to be used in CDATA content.
Use lines to escape values to be used in CDATA content, where
line breaks are to be indicated with
tags.
Examples:
var alpha = 'Don't use <blink>Flash</blink> & "stuff" in HTML.';
var beta = "1. First line\n2. second line\n3. third line";
resp.write("""
<div title="${HEsc.attr(alpha)}">
<p>${HEsc.text(alpha)}</p>
<p>${HEsc.text(123)}</p>
<p>${HEsc.lines(beta)}</p>
</div>
""");
Writes out:
<div title="Don't use <blink>Flash</blink> & "stuff".">
<p>Don't use <blink>Flash</blink> & other "stuff".</p>
<p>123</p>
<p>1. First line<br/>2. second line<br/>3. third line</p>
</div>
Constructors
- HEsc()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited