Namespace gadgets.util
Provides general-purpose utility functions.
Defined in: gadgets.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
gadgets.util.escapeString(str)
Escapes the input using html entities to make it safer.
|
| <static> |
gadgets.util.getFeatureParameters(feature)
Gets the feature parameters.
|
| <static> |
gadgets.util.hasFeature(feature)
Returns whether the current feature is supported.
|
| <inner> |
init(config)
Initializes feature parameters.
|
| <inner> |
Parses URL parameters into an object.
|
| <static> |
gadgets.util.registerOnLoadHandler(callback)
Registers an onload handler.
|
| <static> |
gadgets.util.sanitizeHTML(text)
|
| <inner> |
unescapeEntity(match, value)
Regular expression callback that returns strings from unicode code points.
|
| <static> |
gadgets.util.unescapeString(str)
Reverses escapeString
|
Method Detail
<static>
{String}
gadgets.util.escapeString(str)
Escapes the input using html entities to make it safer.
Currently not in the spec -- future proposals may change
how this is handled.
TODO: Parsing the string would probably be more accurate and faster than
a bunch of regular expressions.
- Parameters:
- {String} str
- The string to escape
- Returns:
- {String} The escaped string
<static>
{Object}
gadgets.util.getFeatureParameters(feature)
Gets the feature parameters.
- Parameters:
- {String} feature
- The feature to get parameters for
- Returns:
- {Object} The parameters for the given feature, or null
<static>
{Boolean}
gadgets.util.hasFeature(feature)
Returns whether the current feature is supported.
- Parameters:
- {String} feature
- The feature to test for
- Returns:
- {Boolean} True if the feature is supported
<inner>
init(config)
Initializes feature parameters.
- Parameters:
- config
<inner>
{Array.<String>}
parseUrlParams()
Parses URL parameters into an object.
- Returns:
- {Array.<String>} The parameters
<static>
gadgets.util.registerOnLoadHandler(callback)
Registers an onload handler.
- Parameters:
- {Function} callback
- The handler to run
<static>
gadgets.util.sanitizeHTML(text)
- Parameters:
- text
<inner>
{String}
unescapeEntity(match, value)
Regular expression callback that returns strings from unicode code points.
- Parameters:
- {Array} match
- Ignored
- {String} value
- The codepoint value to convert
- Returns:
- {String} The character corresponding to value.
<static>
gadgets.util.unescapeString(str)
Reverses escapeString
- Parameters:
- {String} str
- The string to unescape.