xpath-ts2
Version:
DOM 3 and 4 XPath 1.0 implementation for browser and Node.js environment with support for typescript 5.
33 lines • 1.05 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.XPath = void 0;
class XPath {
expression;
constructor(e) {
this.expression = e;
}
toString() {
return this.expression.toString();
}
evaluate(c) {
c.contextNode = c.expressionContextNode;
c.contextSize = 1;
c.contextPosition = 1;
// [2017-11-25] Removed usage of .implementation.hasFeature() since it does
// not reliably detect HTML DOMs (always returns false in xmldom and true in browsers)
if (c.isHtml) {
if (c.caseInsensitive === undefined) {
c.caseInsensitive = true;
}
if (c.allowAnyNamespaceForNoPrefix === undefined) {
c.allowAnyNamespaceForNoPrefix = true;
}
}
if (c.caseInsensitive === undefined) {
c.caseInsensitive = false;
}
return this.expression.evaluate(c);
}
}
exports.XPath = XPath;
//# sourceMappingURL=xpath.js.map
;