Html程序  |  32行  |  752 B

<body>
<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=12452">bug 12452</a>:
XPath id() function is not supported.</p>

  <div id=test1 style="display:none">
    a
  </div>
  <div id=test2 style="display:none">
    b c
    d
  </div>

  <div id="a"></div>
  <div id="b"></div>
  <div id="c"></div>
  <div id="d"></div>

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

  var UNORDERED_NODE_SNAPSHOT_TYPE = 6;

  result = document.evaluate("id(id(' test1  test2 '))", document.body, null, UNORDERED_NODE_SNAPSHOT_TYPE, null);

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