in apps/mountebank-mock/mountebank-source/src/models/xpath.js [13:41]
function xpathSelect (selectFn, selector, doc) {
if (!helpers.defined(doc)) {
return [];
}
if (doc && doc.implementation) {
// Monkey patch due to some legacy case sensitivity check in xpath
// Couldn't find a way to patch xpath due to closures so patched the dom instead
const originalHasFeature = doc.implementation.hasFeature;
doc.implementation.hasFeature = (feature, version) => {
if (feature === 'HTML' && version === '2.0') {
return false;
}
else {
return originalHasFeature.apply(doc.implementation, [feature, version]);
}
};
}
try {
return selectFn(selector, doc);
}
catch (e) {
throw errors.ValidationError('malformed xpath predicate selector', {
source: selector,
inner: e
});
}
}