JavaScript : XPathEvaluator not supported in IE

百般思念 提交于 2019-12-22 01:17:10

问题


I have the following function in JavaScript, and it fails to run when using Internet Explorer.

This function extract the value from a HTML tag, if a XPath is supplied.

How can i replace this function, and with what ?

function lookupElementByXPath(path) {
    var evaluator = new XPathEvaluator(); 
    var result = evaluator.evaluate(path, document.documentElement, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null); 
    return result.singleNodeValue;
}

来源:https://stackoverflow.com/questions/12927990/javascript-xpathevaluator-not-supported-in-ie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!