NeedsExamples
gadgets.util
Provides general-purpose utility functions.
;<static> String gadgets.util.escapeString(str)
Parameters
NameTypeDescription |
|
Returns
TypeDescription |
|
Description
Escapes the input using HTML entities to make it safer. The following characters are affected: newline (\n, Unicode code point 10) carriage return (\r, Unicode 13) double quote (", Unicode 34) ampersand (&, Unicode 38) single quote (', Unicode 39) left angle bracket (<, Unicode 60) right angle bracket (>, Unicode 62) backslash (\, Unicode 92) line separator (Unicode 8232) paragraph separator (Unicode 8233)
;<static> Object gadgets.util.getFeatureParameters(feature)
Parameters
NameTypeDescription |
|
Returns
TypeDescription |
|
Description
Returns the value of parameters for this feature. A gadget specifies parameters using the <Param> subelement of the <Requires> or <Optional> element.
;<static> Boolean gadgets.util.hasFeature(feature)
Parameters
NameTypeDescription |
|
Returns
TypeDescription |
|
Description
Returns whether the specified feature is supported.
;<static> gadgets.util.registerOnLoadHandler(callback)
Parameters
NameTypeDescription |
|
Description
Registers an onload handler; a function that's executed when the gadget loads. Multiple handlers can be registered, and all will be invoked in the same order that they were registered.
;<static> String gadgets.util.sanitizeHtml(text)
Parameters
NameTypeDescription |
|
Returns
TypeDescription |
|
Description
Sanitizes a text string. The returned value is safe to assign to innerHTML. The returned value may include HTML tags. If plain text is desired, use gadgets.util.escapeString instead.
;<static> String gadgets.util.unescapeString(str)
Parameters
NameTypeDescription |
|
Returns
TypeDescription |
|
Description
Reverses escapeString
{{ JsApiAlphaList_(v0.9) }}