selectors should match attribute name with case sensitivity based on element & docume...
[WebKit-https.git] / LayoutTests / fast / dom / SelectorAPI / attrname-case-sensitive.xhtml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html
3      PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN"
4      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6 <head>
7 <script src="../../js/resources/js-test-pre.js"></script>
8 </head>
9 <body>
10     <!-- Check that in XHTML documents CSS selectors always use case-sensitive attribute name matching. -->
11     <div id="content">
12         <div style="display: none">
13             <div baR="10" id="bar"></div>
14
15             <svg xmlns="http://www.w3.org/2000/svg">
16                 <path id="pa" pathLength="200"/>
17             </svg>
18         </div>
19     </div>
20     <script>
21         var content = document.getElementById("content");
22         function checkMatchingSelector(selector, elementId) {
23             shouldBe("document.querySelector('" + selector + "')", "document.getElementById('" + elementId + "')");
24             shouldBeTrue("document.getElementById('" + elementId + "').webkitMatchesSelector('" + selector + "')");
25         }
26
27         function checkNonMatchingSelector(selector) {
28             shouldBeNull("content.querySelector('" + selector + "')");
29         }
30
31         // everything should match case-sensitive
32         checkMatchingSelector('div[baR]', "bar");
33         checkNonMatchingSelector('div[bar]', "bar");
34         checkNonMatchingSelector('div[BAR]', "bar");
35         checkNonMatchingSelector('div[bAR]', "bar");
36         checkMatchingSelector('div[baR="10"]', "bar");
37         checkNonMatchingSelector('div[bar="10"]', "bar");
38         checkNonMatchingSelector('div[BAR="10"]', "bar");
39         checkNonMatchingSelector('div[bAR="10"]', "bar");
40
41         checkMatchingSelector('path[pathLength]', "pa");
42         checkNonMatchingSelector('path[pathlength]');
43         checkNonMatchingSelector('path[pathLengTh]');
44         checkMatchingSelector('path[pathLength="200"]', "pa");
45         checkNonMatchingSelector('path[pathlength="200"]');
46         checkNonMatchingSelector('path[pathLengTh="200"]');
47     </script>
48     <script src="../../js/resources/js-test-post.js"></script>
49 </body>
50 </html>