Modifier and Type | Method and Description |
---|---|
static SafeHtml |
comment(String text)
Converts an arbitrary string into an HTML comment by HTML-escaping the contents and embedding
the result between HTML comment markers.
|
static SafeHtml |
concat(SafeHtml... htmls)
Creates a new SafeHtml which contains, in order, the string representations of the given
htmls . |
static SafeHtml |
fromProto(SafeHtmlProto proto)
Deserializes a SafeHtmlProto into a SafeHtml instance.
|
static SafeHtml |
fromScript(SafeScript script)
Wraps a SafeScript inside a <script type="text/javascript"> tag.
|
static SafeHtml |
fromScriptUrl(TrustedResourceUrl trustedResourceUrl)
Creates a <script type="text/javascript" src="url"><script> where the
src attribute points to the given trustedResourceUrl . |
static SafeHtml |
htmlEscape(String text)
Converts, by HTML-escaping, an arbitrary string into a contract-compliant
SafeHtml . |
static SafeHtmlProto |
toProto(SafeHtml safeHtml)
Serializes a SafeHtml into its opaque protocol message representation.
|
public static SafeHtml fromProto(SafeHtmlProto proto)
Protocol-message forms are intended to be opaque. The fields of the protocol message should
be considered encapsulated and are not intended for direct inspection or manipulation. Protocol
message forms of this type should be produced by toProto(SafeHtml)
or its
equivalent in other implementation languages.
Important: It is unsafe to invoke this method on a protocol message that has been received from an entity outside the application's trust domain. Data coming from the browser is outside the application's trust domain.
public static SafeHtml fromScript(SafeScript script)
public static SafeHtml fromScriptUrl(TrustedResourceUrl trustedResourceUrl)
src
attribute points to the given trustedResourceUrl
.public static SafeHtmlProto toProto(SafeHtml safeHtml)
Protocol message forms of this type are intended to be opaque. The fields of the returned
protocol message should be considered encapsulated and are not intended for direct inspection
or manipulation. Protocol messages can be converted back into a SafeHtml using
fromProto(SafeHtmlProto)
.
public static SafeHtml htmlEscape(String text)
SafeHtml
.public static SafeHtml comment(String text)
Escaping is needed because Internet Explorer supports conditional comments and so may render HTML markup within comments.