From discussion of #7, XML documents don't seem to be finding descendants (EDITTED: this list has been updated so that the checkbox indicates whether the native implementation is matched and the + or - afterward indicates whether the native implementation gets a result for the expression):
This appears to affect all browsers, provided the override is used to force install.
List generated by this code in case anyone wants to clean it up and make some kind of test out of it or tinker with it and see if anything else affects whether it works (EDITTED):
var wgx = {}
wgxpath.install({document: wgx})
var src = '<?xml version="1.0" encoding="utf-8" ?><!DOCTYPE Root><Root><Menu ID="11"></Menu></Root>'
var xml = new DOMParser().parseFromString(src, "application/xml")
var prefixes = ["//", "/descendant::", "/descendant-or-self::", "//self::", "//*[self::"]
prefixes = prefixes.concat(prefixes.map(function(prefix) {
return "/Root" + prefix
}))
prefixes.forEach(function(prefix) {
["Root", "Menu"].forEach(function(tag) {
var resultWGX = wgx.evaluate(prefix + tag + (/[[]/.test(prefix)?"]":""), xml, wgx.createNSResolver(xml), XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue
var resultNative = xml.evaluate(prefix + tag + (/[[]/.test(prefix)?"]":""), xml, xml.createNSResolver(xml), XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue
document.write("- [" + (resultWGX===resultNative?"x":" ") + "] " + (resultNative?"+":"-") + " `" + prefix + tag + (/[[]/.test(prefix)?"]":"") + "`<br />")
})
})
(EDITTED: the old list was generated by this code, which works on browsers that have no native implementation, but does not compare against the native implementation to automatically identify the few expression combinations that wouldn't work anyway:)
wgxpath.install(window, true)
var src = '<?xml version="1.0" encoding="utf-8" ?><!DOCTYPE Root><Root><Menu ID="11"></Menu></Root>'
var xml = new DOMParser().parseFromString(src, "application/xml")
var prefixes = ["//", "/descendant::", "/descendant-or-self::", "//self::", "//*[self::"]
prefixes = prefixes.concat(prefixes.map(function(prefix) {
return "/Root" + prefix
}))
prefixes.forEach(function(prefix) {
["Root", "Menu"].forEach(function(tag) {
var result = xml.evaluate(prefix + tag + (/[[]/.test(prefix)?"]":""), xml, xml.createNSResolver(xml), XPathResult.ANY_TYPE, null)
document.write("- [" + (result.iterateNext()?"x":" ") + "] `" + prefix + tag + (/[[]/.test(prefix)?"]":"") + "`<br />")
})
})
From discussion of #7, XML documents don't seem to be finding descendants (EDITTED: this list has been updated so that the checkbox indicates whether the native implementation is matched and the + or - afterward indicates whether the native implementation gets a result for the expression):
//Root//Menu/descendant::Root/descendant::Menu/descendant-or-self::Root/descendant-or-self::Menu//self::Root//self::Menu//*[self::Root]//*[self::Menu]/Root//Root/Root//Menu/Root/descendant::Root/Root/descendant::Menu/Root/descendant-or-self::Root/Root/descendant-or-self::Menu/Root//self::Root/Root//self::Menu/Root//*[self::Root]/Root//*[self::Menu]This appears to affect all browsers,
provided the override is used to force install.List generated by this code in case anyone wants to clean it up and make some kind of test out of it or tinker with it and see if anything else affects whether it works (EDITTED):
(EDITTED: the old list was generated by this code, which works on browsers that have no native implementation, but does not compare against the native implementation to automatically identify the few expression combinations that wouldn't work anyway:)