blob: e56b1e81af6e1ef5d43b2b4a2a26d3c9b7dad928 [file] [log] [blame]
<p>Test for <a href="">bug 12340</a>:
XPath name() function doesn't work with nodes and attributes in null namespace.
if (window.testRunner)
var strXML = '<doc><record/><record/><record/><record/><record foo="a-a"/></doc>';
var doc = (new DOMParser()).parseFromString(strXML, "text/xml");
// This matches in both Firefox and WebKit, which indicates that
// XPathEvaluator does not normalize the document.
doc.firstChild.childNodes[0].setAttributeNS("bar", "foo", "-a-");
// This doesn't match.
doc.firstChild.childNodes[1].setAttributeNS("bar", "b:foo", "-a-");
// These both match, too.
doc.firstChild.childNodes[2].setAttributeNS("", "foo", "-a-");
doc.firstChild.childNodes[3].setAttributeNS(null, "foo", "-a-");
// The last (static) record matches, of course.
var xpe = new XPathEvaluator();
var objResult = xpe.evaluate("//@*[name()='foo']", doc, null, 0, null);
var itm = null;
var objNodes = [];
while (itm = objResult.iterateNext())
if (objNodes.length == 4)
document.write("FAILURE: matched " + objNodes.length + " nodes.");