summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/xpath/4XPath/Borrowed/cz_20030217.html
blob: 41efa2e7832c832deb70b419105ac41fedbbd124 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!-- http://mail.python.org/pipermail/xml-sig/2003-February/009070.html -->
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../../js/resources/js-test-style.css">
<script src="../../../js/resources/js-test-pre.js"></script>
</head>
<body>
<div id="console"></div>

<script>
    SRC = '<?xml version=\'1.0\'?>\
<alpha>\
  <beta no="a">\
    <gamma>\
      <delta>1</delta>\
    </gamma>\
    <delta mark="foo">2</delta>\
    <gamma mark="bar">\
      <delta>3</delta>\
    </gamma>\
  </beta>\
  <beta no="b">\
    <delta>4</delta>\
    <gamma>\
      <delta>5</delta>\
    </gamma>\
  </beta>\
</alpha>';

    doc = (new DOMParser).parseFromString(SRC, "application/xml");

    expr = '/alpha/beta[attribute::no = "a"]'
    nodeset = doc.evaluate(expr, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    shouldBe('nodeset.snapshotLength', '1')

    expr = '/alpha/beta[attribute::no = 1]'
    nodeset = doc.evaluate(expr, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    shouldBe('nodeset.snapshotLength', '0')

    expr = '/alpha/beta[@no = "a"]'
    nodeset = doc.evaluate(expr, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    shouldBe('nodeset.snapshotLength', '1')

    expr = '/alpha/beta[@no = 1]'
    nodeset = doc.evaluate(expr, doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    shouldBe('nodeset.snapshotLength', '0')

    var successfullyParsed = true;

</script>
<script src="../../../js/resources/js-test-post.js"></script>
</body>
</html>