Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Element / attribute-uppercase.html
blobc33dc31756a65a2567846017c04feb8cc8f6e31e
1 <html>
2 <head>
3 <script>
5 function write(str) {
6 pre = document.getElementById('console');
7 text = document.createTextNode(str + '\n');
8 pre.appendChild(text);
11 function runTests() {
12 if (window.testRunner)
13 testRunner.dumpAsText();
15 elem = document.createElement('test');
16 elem.setAttribute('attr_name', 'attr_value');
17 write("Add an attribute:");
18 write("");
19 write(" setAttribute(attr_name)");
20 write("");
21 write("The following should be non-empty, true, or non-null.");
22 write("");
23 write(" getAttribute(attr_name) = " + elem.getAttribute('attr_name'));
24 write(" hasAttribute(attr_name) = " + elem.hasAttribute('attr_name'));
25 write(" getAttributeNode(attr_name) = " + elem.getAttributeNode('attr_name'));
26 write(" attributes.getNamedItem(attr_name) = " + elem.attributes.getNamedItem('attr_name'));
27 write("");
28 write(" getAttributeNS(attr_name) = " + elem.getAttributeNS(null, 'attr_name'));
29 write(" hasAttributeNS(attr_name) = " + elem.hasAttributeNS(null, 'attr_name'));
30 write(" getAttributeNodeNS(attr_name) = " + elem.getAttributeNodeNS(null, 'attr_name'));
31 write(" attributes.getNamedItemNS(attr_name) = " + elem.attributes.getNamedItemNS(null, 'attr_name'));
32 write("");
33 write(" getAttribute(ATTR_NAME) = " + elem.getAttribute('ATTR_NAME'));
34 write(" hasAttribute(ATTR_NAME) = " + elem.hasAttribute('ATTR_NAME'));
35 write(" getAttributeNode(ATTR_NAME) = " + elem.getAttributeNode('ATTR_NAME'));
36 write(" attributes.getNamedItem(ATTR_NAME) = " + elem.attributes.getNamedItem('ATTR_NAME'));
37 write("");
38 write("The following should be empty, false, or null.");
39 write("");
40 write(" getAttributeNS(ATTR_NAME) = " + elem.getAttributeNS(null, 'ATTR_NAME'));
41 write(" hasAttributeNS(ATTR_NAME) = " + elem.hasAttributeNS(null, 'ATTR_NAME'));
42 write(" getAttributeNodeNS(ATTR_NAME) = " + elem.getAttributeNodeNS(null, 'ATTR_NAME'));
43 write(" attributes.getNamedItemNS(ATTR_NAME) = " + elem.attributes.getNamedItemNS(null, 'ATTR_NAME'));
44 write("");
45 write("The following should successfully remove the attribute.");
46 write("");
47 elem.setAttribute('attr_name', 'attr_value');
48 elem.removeAttribute('attr_name');
49 write(" setAttribute(attr_name); removeAttribute(attr_name)")
50 write(" hasAttribute(attr_name) = " + elem.hasAttribute('attr_name'));
51 elem.setAttribute('attr_name', 'attr_value');
52 elem.removeAttributeNS(null, 'attr_name');
53 write(" setAttribute(attr_name); removeAttributeNS(attr_name)")
54 write(" hasAttribute(attr_name) = " + elem.hasAttribute('attr_name'));
55 elem.setAttribute('attr_name', 'attr_value');
56 elem.attributes.removeNamedItem('attr_name');
57 write(" setAttribute(attr_name); attributes.removeNamedItem(attr_name)")
58 write(" hasAttribute(attr_name) = " + elem.hasAttribute('attr_name'));
59 elem.setAttribute('attr_name', 'attr_value');
60 elem.attributes.removeNamedItemNS(null, 'attr_name');
61 write(" setAttribute(attr_name); attributes.removeNamedItemNS(null, attr_name)")
62 write(" hasAttribute(attr_name) = " + elem.hasAttribute('attr_name'));
63 write("");
64 elem.setAttribute('attr_name', 'attr_value');
65 elem.removeAttribute('ATTR_NAME');
66 write(" setAttribute(attr_name); removeAttribute(ATTR_NAME)")
67 write(" hasAttribute(attr_name) = " + elem.hasAttribute('attr_name'));
68 elem.setAttribute('attr_name', 'attr_value');
69 elem.attributes.removeNamedItem('ATTR_NAME');
70 write(" setAttribute(attr_name); attributes.removeNamedItem(ATTR_NAME)")
71 write(" hasAttribute(attr_name) = " + elem.hasAttribute('attr_name'));
72 write("");
73 write("The following should fail to remove the attribute.");
74 write("");
75 elem.setAttribute('attr_name', 'attr_value');
76 elem.removeAttributeNS(null, 'ATTR_NAME');
77 write(" setAttribute(attr_name); removeAttributeNS(ATTR_NAME)")
78 write(" hasAttribute(attr_name) = " + elem.hasAttribute('attr_name'));
79 write("");
80 write("The following should fail to remove the attribute with an exception.");
81 write("");
82 elem.setAttribute('attr_name', 'attr_value');
83 try {
84 elem.attributes.removeNamedItemNS(null, 'ATTR_NAME');
85 write(" attributes.removeNamedItemNS(ATTR_NAME) was expected to raise an exception but did not");
86 } catch (e) {
87 write(" attributes.removeNamedItemNS(ATTR_NAME) raised an exception as expected");
89 write(" hasAttribute(attr_name) = " + elem.hasAttribute('attr_name'));
90 write("");
91 write("The following should set a lowercase attribute, so the result should be true.");
92 write("");
93 elem.setAttributeNS(null, 'attr_name', 'attr_value');
94 write(" setAttributeNS(attr_name)");
95 write(" hasAttribute(attr_name) = " + elem.hasAttribute('attr_name'));
96 elem.removeAttributeNS(null, 'attr_name');
97 write("");
98 write("The following should set an uppercase attribute, so the result should be false.");
99 write("");
100 elem.setAttributeNS(null, 'ATTR_NAME', 'attr_value');
101 write(" setAttributeNS(ATTR_NAME)");
102 write(" hasAttribute(attr_name) = " + elem.hasAttribute('attr_name'));
103 elem.removeAttributeNS(null, 'ATTR_NAME');
106 </script>
107 </head>
109 <body onload="runTests();">
110 <pre id="console">This test checks whether attribute names with uppercase work properly in HTML documents.
112 </pre>
113 </body>
115 </html>