gadgets.util
Method
gadgets.util.escapeString
Escapes with HTML entities. The following characters are affected.
- Newline (\n, Unicode 10)
- Carriage return (\r, Unicode 13)
- Double quotation mark (", Unicode 34)
- Ampersand (&, Unicode 38)
- Single quotation mark (', Unicode 39)
- Less-than sign (<, Unicode 60)
- Greater-than sign (>, Unicode 62)
- Backslash (\, Unicode 92)
- Line separator (Unicode 8232)
- Paragraph separator (Unicode 8233)
Parameter
Name |
Type |
Description |
---|---|---|
str |
String |
The string to escape. |
Return value
Type |
Description |
---|---|
String |
The escaped string. |
Sample
gadgets.util.getFeatureParameters
It returns the value of parameters for this feature. A gadget specifies parameters using the sub-element of the element or element.
Parameter
Name |
Type |
Description |
---|---|---|
feature |
String |
The feature for acquiring parameters. |
Return value
Type |
Description |
---|---|
Object |
The parameters for the specified feature. If none, null. |
gadgets.util.hasFeature
Returns whether or not the specified feature is supported.
Parameter
Name |
Type |
Description |
---|---|---|
feature |
String |
Search feature. |
Return value
Type |
Description |
---|---|
Boolean |
True if the feature is supported. |
gadgets.util.registerOnLoadHandler
Registers an onload handler. This handler is a function that is executed when the gadget loads.
Parameter
Name |
Type |
Description |
---|---|---|
callback |
Function |
The handler to be executed. |
Return value
None
Sample
gadgets.util.unescapeString
Returns the HTML escaped string to its original form.
Parameter
Name |
Type |
Description |
---|---|---|
str |
String |
The string to unescape. |
Return value
Type |
Description |
---|---|
String |
The unescaped string. |
Sample
gadgets.util.sanitizeHtml
Sanitizes the assigned string.
Parameter
Name |
Type |
Description |
---|---|---|
htmlText |
String |
String to be sanitized |
opt_uriPolicy |
Function |
Process for sanitizing a URL |
opt_nmTokenPolicy |
Function |
Process for sanitizing an id, class, etc. |
Sample
Revision History
- 12/2010
- Initial Release.