Home | History | Annotate | Download | only in xpath
      1 <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=11815">bug 11815</a>:
      2 XPathEvaluator behavior does not match Firefox - substring() and empty element.</p>
      3 <script>
      4 if (window.layoutTestController)
      5   layoutTestController.dumpAsText();
      6 
      7 var strXML = '<data><record></record><record>-hi-</record></data>';
      8 var doc = (new DOMParser()).parseFromString(strXML, "text/xml");
      9 var xpe = new XPathEvaluator();
     10 var objResult = xpe.evaluate("//record[substring(.,1,1)='-']", doc, null, 0, null);
     11 var itm = null;
     12 var objNodes = [];
     13 while (itm = objResult.iterateNext()) objNodes.push(itm);
     14 
     15 if (objNodes.length == 1)
     16   document.write("SUCCESS");
     17 else
     18   document.write("FAILURE: matched " + objNodes.length + " nodes.");
     19 </script>
     20