summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/xpath/implicit-node-args.html
blob: 52df68ad894d472e2e7f4fffb016db15438f496b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<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>