xpath icon indicating copy to clipboard operation
xpath copied to clipboard

Issues when referencing attributes from domino DOMs

Open niedzielski opened this issue 10 years ago • 3 comments

var doc = domino.createDocument("<div><table class='infobox biota'></table></div>");
var select = xpath.useNamespaces({"x": "http://www.w3.org/1999/xhtml"});
var nodes = select("//x:table[contains(@class,'infobox')]", doc);

TypeError: Cannot call method 'indexOf' of undefined
    at Object.Functions.contains (/home/stephen/dev/wmf/restbase/mobileapps/node_modules/xpath/xpath.js:3436:25)
    at FunctionCall.evaluate (/home/stephen/dev/wmf/restbase/mobileapps/node_modules/xpath/xpath.js:2320:11)
    at PathExpr.evaluate (/home/stephen/dev/wmf/restbase/mobileapps/node_modules/xpath/xpath.js:1673:24)
    at PathExpr.predicateMatches (/home/stephen/dev/wmf/restbase/mobileapps/node_modules/xpath/xpath.js:1973:17)
    at PathExpr.evaluate (/home/stephen/dev/wmf/restbase/mobileapps/node_modules/xpath/xpath.js:1958:15)
    at XPath.evaluate (/home/stephen/dev/wmf/restbase/mobileapps/node_modules/xpath/xpath.js:1215:25)
    at XPathExpression.evaluate (/home/stephen/dev/wmf/restbase/mobileapps/node_modules/xpath/xpath.js:4124:26)
    at Object.exports.selectWithResolver (/home/stephen/dev/wmf/restbase/mobileapps/node_modules/xpath/xpath.js:4313:26)
    at /home/stephen/dev/wmf/restbase/mobileapps/node_modules/xpath/xpath.js:4305:18
    at Object.removeInfobox (/home/stephen/dev/wmf/restbase/mobileapps/lib/transforms.js:53:15)
    at buildInfobox (/home/stephen/dev/wmf/restbase/mobileapps/routes/mobile-html-sections.js:84:23)
    at buildLead (/home/stephen/dev/wmf/restbase/mobileapps/routes/mobile-html-sections.js:100:18)
    at /home/stephen/dev/wmf/restbase/mobileapps/routes/mobile-html-sections.js:140:30
    at tryCatcher (/home/stephen/dev/wmf/restbase/mobileapps/node_modules/bluebird/js/main/util.js:24:31)
    at Promise._settlePromiseFromHandler (/home/stephen/dev/wmf/restbase/mobileapps/node_modules/bluebird/js/main/promise.js:582:31)
    at Promise._settlePromiseAt (/home/stephen/dev/wmf/restbase/mobileapps/node_modules/bluebird/js/main/promise.js:727:18)

niedzielski avatar Aug 18 '15 23:08 niedzielski

This is not a bug in this library but rather the result of incomplete DOM compliance in domino. I will open an issue there.

JLRishe avatar Jan 26 '16 02:01 JLRishe

I have modified the xpath library to account for this issue: https://github.com/goto100/xpath/commit/ca913d9978a8c4400cb17195bc9ff725e194b5a6

JLRishe avatar Jan 26 '16 02:01 JLRishe

I think this may still not be remedied yet.

JLRishe avatar Jan 26 '16 06:01 JLRishe