summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/xpath/node-name-case-sensitivity.html
blob: 5644801e38b5dfed158d25756e24432860db6698 (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
<html>
<head>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="sometext">
<STRONG>strong</STRONG><strong>strong</strong><FOO>FOO</FOO><foo>foo</foo>
</p>
<div id="console"></div>
<script type="text/javascript">

    function testHTML(query, expectedCount)
    {
        res = document.evaluate(query, document, function() { return "http://www.w3.org/1999/xhtml" }, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
        debug("HTML " + query);
        shouldBe('res.snapshotLength', expectedCount);
    }

    function testXML(query, expectedCount)
    {
        res = doc.evaluate(query, doc, function() { return "http://www.w3.org/1999/xhtml" }, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
        debug("XML " + query);
        shouldBe('res.snapshotLength', expectedCount);
    }

    testHTML('//*[@id="sometext"]//strong', '2');
    testHTML('//*[@id="sometext"]//Strong', '2');
    testHTML('//*[@id="Sometext"]//strong', '0');
    testHTML('//*[@id="sometext"]//foo', '2');
    testHTML('//*[@id="sometext"]//FOO', '2');

    var doc = (new DOMParser).parseFromString('<p id="sometext" xmlns="http://www.w3.org/1999/xhtml"><STRONG>strong</STRONG><strong>strong</strong><FOO xmlns="">FOO</FOO><foo xmlns="">foo</foo></p>', 'application/xhtml+xml');

    testXML('//*[@id="sometext"]//x:strong', '1');
    testXML('//*[@id="sometext"]//x:Strong', '0');
    testXML('//*[@id="Sometext"]//x:strong', '0');
    testXML('//*[@id="sometext"]//foo', '1');
    testXML('//*[@id="sometext"]//FOO', '1');

    var successfullyParsed = true;

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