code: function getEngineFor(inDocument) {
          if (allowNativeXPath &&
              nativeEngine.setDocument(inDocument).isAvailable()) {
              return nativeEngine;
          }
  
          var currentEngine = engines[currentEngineName];
  
          if (currentEngine &&
              currentEngine.setDocument(inDocument).isAvailable()) {
              return currentEngine;
          }
  
          return engines[defaultEngineName].setDocument(inDocument);
      }
docs: Returns the most sensible engine given the settings and the document
  object.