diff --git a/src/js/form-model.js b/src/js/form-model.js index 0db376ad1..53c049b33 100644 --- a/src/js/form-model.js +++ b/src/js/form-model.js @@ -1561,30 +1561,18 @@ FormModel.prototype.evaluate = function ( } // try native to see if that works... (will not work if the expr contains custom OpenRosa functions) - if ( - tryNative && - typeof doc.evaluate !== 'undefined' && - !OPENROSA.test(expr) - ) { - try { - // console.log( 'trying the blazing fast native XPath Evaluator for', expr, index ); - result = doc.evaluate( - expr, - context, - this.getNsResolver(), - resTypeNum, - null - ); - } catch (e) { - // console.log( '%cWell native XPath evaluation did not work... No worries, worth a shot, the expression probably ' + - // 'contained unknown OpenRosa functions or errors:', expr ); - } - } - - // if that didn't work, try the slow XPathJS evaluator - if (!result) { + try { + // console.log( 'trying the blazing fast native XPath Evaluator for', expr, index ); + result = doc.evaluate( + expr, + context, + this.getNsResolver(), + resTypeNum, + null + ); + } catch { try { - if (typeof doc.jsEvaluate === 'undefined') { + if ( typeof doc.jsEvaluate === 'undefined' ) { this.bindJsEvaluator(); } // console.log( 'trying the slow enketo-xpathjs "openrosa" evaluator for', expr, index ); @@ -1595,7 +1583,7 @@ FormModel.prototype.evaluate = function ( resTypeNum, null ); - } catch (e) { + } catch ( e ) { throw new FormLogicError( `Could not evaluate: ${expr}, message: ${e.message}` );