goog.html.SafeHtml.create
, goog.html.SafeHtml.htmlEscape
),
etc and not by invoking its constructor. The constructor intentionally
takes no parameters and the type is immutable; hence only a default instance
corresponding to the empty string can be obtained via constructor invocation.
![]()
No description.
Arguments:
|
code » | |||||
Creates a new SafeHtml object by concatenating the values.
Arguments:
|
code » | |||||
Creates a new SafeHtml object with known directionality by concatenating the
values.
Arguments:
|
code » | |||||
Creates a SafeHtml content consisting of a tag with optional attributes and
optional content.
For convenience tag names and attribute names are accepted as regular
strings, instead of goog.string.Const. Nevertheless, you should not pass
user-controlled values to these parameters. Note that these parameters are
syntactically validated at runtime, and invalid values will result in
an exception.
Example usage:
goog.html.SafeHtml.create('br');
goog.html.SafeHtml.create('div', {'class': 'a'});
goog.html.SafeHtml.create('p', {}, 'a');
goog.html.SafeHtml.create('p', {}, goog.html.SafeHtml.create('br'));
goog.html.SafeHtml.create('span', {
'style': {'margin': '0'}
});
Arguments:
Returns: !goog.html.SafeHtml
The SafeHtml content with the tag.
|
code » | |||||
Utility method to create SafeHtml instances.
This function is considered "package private", i.e. calls (using "suppress
visibility") from other files within this package are considered acceptable.
DO NOT call this function from outside the goog.html package; use appropriate
wrappers instead.
Arguments:
Returns: !goog.html.SafeHtml
The initialized SafeHtml object.
|
code » | |||||
Creates a SafeHtml content with known directionality consisting of a tag with
optional attributes and optional content.
Arguments:
Returns: !goog.html.SafeHtml
The SafeHtml content with the tag.
|
code » | |||||
Use goog.html.SafeHtml.htmlEscape.
Coerces an arbitrary object into a SafeHtml object.
If
textOrHtml is already of type goog.html.SafeHtml , the same
object is returned. Otherwise, textOrHtml is coerced to string, and
HTML-escaped. If textOrHtml is of a type that implements
goog.i18n.bidi.DirectionalString , its directionality, if known, is
preserved.
Arguments:
Returns: !goog.html.SafeHtml
The resulting SafeHtml object.
|
code » | |||||
Gets value allowed in "style" attribute.
Arguments:
Returns: string
Unwrapped value.
|
code » | |||||
Returns HTML-escaped text as a SafeHtml object.
If text is of a type that implements
goog.i18n.bidi.DirectionalString , the directionality of the new
SafeHtml object is set to text 's directionality, if known.
Otherwise, the directionality of the resulting SafeHtml is unknown (i.e.,
null ).
Arguments:
Returns: !goog.html.SafeHtml
The escaped text, wrapped as a SafeHtml.
|
code » | |||||
Returns HTML-escaped text as a SafeHtml object, with newlines changed to
<br>.
Arguments:
Returns: !goog.html.SafeHtml
The escaped text, wrapped as a SafeHtml.
|
code » | |||||
Performs a runtime check that the provided object is indeed a SafeHtml
object, and returns its value.
Arguments:
Returns: string
The SafeHtml object's contained string, unless the run-time
type check fails. In that case,
unwrap returns an innocuous
string, or, if assertions are enabled, throws
goog.asserts.AssertionError .
|
code » |