summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/xpath/id-path.html
blob: 28b91da3bd34989c891ec7c3e861d5398ea61d4b (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
<body>
<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=12485">bug 12485</a>:
XPath id() function doesn't work as root in paths.</p>

  <div id="a"><div></div></div>
  <div id="bb"><div></div></div>
  <div id="ccc"><div></div></div>

<script>
  if (window.layoutTestController)
    layoutTestController.dumpAsText();

  var UNORDERED_NODE_SNAPSHOT_TYPE = 6;

  try {
    result = document.evaluate("id('a bb ccc')[@id != 'ccc']/div", document.body, null, UNORDERED_NODE_SNAPSHOT_TYPE, null);

    if (2 == result.snapshotLength)
      document.write("SUCCESS");
    else
      document.write("FAILURE: " + result.snapshotLength + " result nodes (should be 2)");
  } catch (ex) {
    document.write("FAILURE: " + ex);
  }
</script>
</body>