1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-10 11:35:52 +01:00

Document the util.* functions' useful return values.

This commit is contained in:
Štěpán Němec
2011-01-11 11:17:11 +01:00
parent 1256e37286
commit 49fea83698

View File

@@ -141,6 +141,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* @param {string} list Character list, e.g., "a b d-xA-Z" produces /[abd-xA-Z]/. * @param {string} list Character list, e.g., "a b d-xA-Z" produces /[abd-xA-Z]/.
* @param {string} accepted Character range(s) to accept, e.g. "a-zA-Z" for * @param {string} accepted Character range(s) to accept, e.g. "a-zA-Z" for
* ASCII letters. Used to validate *list*. * ASCII letters. Used to validate *list*.
* @returns {RegExp}
*/ */
charListToRegexp: function charListToRegexp(list, accepted) { charListToRegexp: function charListToRegexp(list, accepted) {
let list = list.replace(/\s+/g, ""); let list = list.replace(/\s+/g, "");
@@ -561,6 +562,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* @default *doc* * @default *doc*
* @param {boolean} asIterator Whether to return the results as an * @param {boolean} asIterator Whether to return the results as an
* XPath iterator. * XPath iterator.
* @returns {Object} Iterable result of the evaluation.
*/ */
evaluateXPath: update( evaluateXPath: update(
function evaluateXPath(expression, doc, elem, asIterator) { function evaluateXPath(expression, doc, elem, asIterator) {
@@ -654,6 +656,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* Returns the file which backs a given URL, if available. * Returns the file which backs a given URL, if available.
* *
* @param {nsIURI} uri The URI for which to find a file. * @param {nsIURI} uri The URI for which to find a file.
* @returns {File|null}
*/ */
getFile: function getFile(uri) { getFile: function getFile(uri) {
try { try {
@@ -691,6 +694,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* or greater. * or greater.
* *
* @param {string} ver The required version. * @param {string} ver The required version.
* @returns {boolean}
*/ */
haveGecko: function (ver) services.versionCompare.compare(services.runtime.platformVersion, ver) >= 0, haveGecko: function (ver) services.versionCompare.compare(services.runtime.platformVersion, ver) >= 0,
@@ -792,6 +796,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* Returns true if the given DOM node is currently visible. * Returns true if the given DOM node is currently visible.
* *
* @param {Node} node * @param {Node} node
* @returns {boolean}
*/ */
isVisible: function (node) { isVisible: function (node) {
let style = util.computedStyle(node); let style = util.computedStyle(node);
@@ -1092,6 +1097,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* that is the equivalent of submitting the form. * that is the equivalent of submitting the form.
* *
* @param {nsINode} field One of the fields of the given form. * @param {nsINode} field One of the fields of the given form.
* @returns {array}
*/ */
// Nuances gleaned from browser.jar/content/browser/browser.js // Nuances gleaned from browser.jar/content/browser/browser.js
parseForm: function parseForm(field) { parseForm: function parseForm(field) {
@@ -1203,6 +1209,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* @param {string|XML} expr The expression to compile into a RegExp. * @param {string|XML} expr The expression to compile into a RegExp.
* @param {string} flags Flags to apply to the new RegExp. * @param {string} flags Flags to apply to the new RegExp.
* @param {object} tokens The tokens to substitute. @optional * @param {object} tokens The tokens to substitute. @optional
* @returns {RegExp} A custom regexp object.
*/ */
regexp: update(function (expr, flags, tokens) { regexp: update(function (expr, flags, tokens) {
if (isinstance(expr, ["RegExp"])) if (isinstance(expr, ["RegExp"]))
@@ -1387,6 +1394,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* *
* @param {string} str * @param {string} str
* @param {RegExp} marker * @param {RegExp} marker
* @returns {[string]}
*/ */
splitLiteral: function splitLiteral(str, marker) { splitLiteral: function splitLiteral(str, marker) {
let results = []; let results = [];