summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/domxpath/helpers.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/domxpath/helpers.js')
-rw-r--r--testing/web-platform/tests/domxpath/helpers.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/web-platform/tests/domxpath/helpers.js b/testing/web-platform/tests/domxpath/helpers.js
new file mode 100644
index 0000000000..0805bd682b
--- /dev/null
+++ b/testing/web-platform/tests/domxpath/helpers.js
@@ -0,0 +1,14 @@
+function evaluateBoolean(expression, context) {
+ let doc = context.ownerDocument || context;
+ return doc.evaluate(expression, context, null, XPathResult.BOOLEAN_TYPE, null).booleanValue;
+}
+
+function evaluateNumber(expression, context) {
+ let doc = context.ownerDocument || context;
+ return doc.evaluate(expression, context, null, XPathResult.NUMBER_TYPE, null).numberValue;
+}
+
+function evaluateString(expression, context) {
+ let doc = context.ownerDocument || context;
+ return doc.evaluate(expression, context, null, XPathResult.STRING_TYPE, null).stringValue;
+}