<html> <body> <div style="display:none">123</div> <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=12602">bug 12602</a>: </p> <script> if (window.layoutTestController) layoutTestController.dumpAsText(); var tests = [ "//div[string() = '123']" , "//div[normalize-space() = '123']" , "//div[string-length() = 3]" , "//div[number() = 123]" ]; while (test = tests.pop()) { var result = document.evaluate(test, document.documentElement, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); if (result.snapshotLength == 1) document.write("<pre>" + test + ": SUCCESS</pre>"); else document.write("<pre>" + test + ": FAILURE. " + result.snapshotLength + " node(s) matched - should be 1</pre>"); } </script> </body> </html>