summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/domxpath/helpers.js
blob: 0805bd682b48461588250a22018a6bd90990d002 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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;
}