Home | History | Annotate | Download | only in xpath
      1 <html>
      2   <body>
      3     <div style="display:none">123</div>
      4     <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=12602">bug 12602</a>:
      5     </p>
      6     <script>
      7         if (window.layoutTestController)
      8             layoutTestController.dumpAsText();
      9 
     10         var tests = [
     11               "//div[string() = '123']"
     12               , "//div[normalize-space() = '123']"
     13               , "//div[string-length() = 3]"
     14               , "//div[number() = 123]"
     15         ];
     16 
     17         while (test = tests.pop()) {
     18             var result = document.evaluate(test, document.documentElement, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
     19             if (result.snapshotLength == 1)
     20                 document.write("<pre>" + test + ": SUCCESS</pre>");
     21             else
     22                 document.write("<pre>" + test + ": FAILURE. " + result.snapshotLength + " node(s) matched - should be 1</pre>");
     23         }
     24     </script>
     25   </body>
     26 </html>
     27