| <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.testRunner) |
| testRunner.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> |