summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/xpath/empty-string-substring.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/fast/xpath/empty-string-substring.html')
-rw-r--r--LayoutTests/fast/xpath/empty-string-substring.html19
1 files changed, 19 insertions, 0 deletions
diff --git a/LayoutTests/fast/xpath/empty-string-substring.html b/LayoutTests/fast/xpath/empty-string-substring.html
new file mode 100644
index 0000000..c90dc0a
--- /dev/null
+++ b/LayoutTests/fast/xpath/empty-string-substring.html
@@ -0,0 +1,19 @@
+<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=11815">bug 11815</a>:
+XPathEvaluator behavior does not match Firefox - substring() and empty element.</p>
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+var strXML = '<data><record></record><record>-hi-</record></data>';
+var doc = (new DOMParser()).parseFromString(strXML, "text/xml");
+var xpe = new XPathEvaluator();
+var objResult = xpe.evaluate("//record[substring(.,1,1)='-']", doc, null, 0, null);
+var itm = null;
+var objNodes = [];
+while (itm = objResult.iterateNext()) objNodes.push(itm);
+
+if (objNodes.length == 1)
+ document.write("SUCCESS");
+else
+ document.write("FAILURE: matched " + objNodes.length + " nodes.");
+</script>