diff options
Diffstat (limited to 'LayoutTests/fast/xpath/name-null-namespace.html')
-rw-r--r-- | LayoutTests/fast/xpath/name-null-namespace.html | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/LayoutTests/fast/xpath/name-null-namespace.html b/LayoutTests/fast/xpath/name-null-namespace.html new file mode 100644 index 0000000..562f700 --- /dev/null +++ b/LayoutTests/fast/xpath/name-null-namespace.html @@ -0,0 +1,36 @@ +<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=12340">bug 12340</a>: +XPath name() function doesn't work with nodes and attributes in null namespace. +</p> +<script> +if (window.layoutTestController) + layoutTestController.dumpAsText(); + +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()) + objNodes.push(itm); + +if (objNodes.length == 4) + document.write("SUCCESS"); +else + document.write("FAILURE: matched " + objNodes.length + " nodes."); +</script> |