summaryrefslogtreecommitdiff
path: root/common/content/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'common/content/util.js')
-rw-r--r--common/content/util.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/content/util.js b/common/content/util.js
index a8e410bc..c0e9ad47 100644
--- a/common/content/util.js
+++ b/common/content/util.js
@@ -179,6 +179,20 @@ const util = { //{{{
},
/**
+ * Returns an XPath union expression constructed from the specified node
+ * tests. An expression is built with node tests for both the null and
+ * XHTML namespaces. See {@link Buffer#evaluateXPath}.
+ *
+ * @param nodes {Array(string)}
+ * @returns {string}
+ */
+ makeXPath: function makeXPath(nodes)
+ {
+ return util.Array(nodes).map(function (node) [node, "xhtml:" + node]).flatten()
+ .map(function (node) "//" + node).join(" | ");
+ },
+
+ /**
* Memoize the lookup of a property in an object.
*
* @param {object} obj The object to alter.