1 <p>Test for
<a href=
"http://bugs.webkit.org/show_bug.cgi?id=12340">bug
12340</a>:
2 XPath name() function doesn't work with nodes and attributes in null namespace.
5 if (window
.layoutTestController
)
6 layoutTestController
.dumpAsText();
8 var strXML
= '<doc><record/><record/><record/><record/><record foo="a-a"/></doc>';
9 var doc
= (new DOMParser()).parseFromString(strXML
, "text/xml");
11 // This matches in both Firefox and WebKit, which indicates that
12 // XPathEvaluator does not normalize the document.
13 doc
.firstChild
.childNodes
[0].setAttributeNS("bar", "foo", "-a-");
15 // This doesn't match.
16 doc
.firstChild
.childNodes
[1].setAttributeNS("bar", "b:foo", "-a-");
18 // These both match, too.
19 doc
.firstChild
.childNodes
[2].setAttributeNS("", "foo", "-a-");
20 doc
.firstChild
.childNodes
[3].setAttributeNS(null, "foo", "-a-");
22 // The last (static) record matches, of course.
25 var xpe
= new XPathEvaluator();
26 var objResult
= xpe
.evaluate("//@*[name()='foo']", doc
, null, 0, null);
29 while (itm
= objResult
.iterateNext())
32 if (objNodes
.length
== 4)
33 document
.write("SUCCESS");
35 document
.write("FAILURE: matched " + objNodes
.length
+ " nodes.");