OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 <script> | 5 <script> |
6 function runTest() | 6 function runTest() |
7 { | 7 { |
8 description("This test verifies that the setAttributeNode() API checks for e
xisting attributes case-insensitively. Thus the value of an existing attribute w
ith the same name but in a different case should get replaced by the new value s
pecified via the setAttributeNode() method."); | 8 description("This test verifies that the setAttributeNode() API checks for e
xisting attributes case-insensitively. Thus the value of an existing attribute w
ith the same name but in a different case should get replaced by the new value s
pecified via the setAttributeNode() method."); |
9 | 9 |
10 var test = document.getElementById("test"); | 10 var test = document.getElementById("test"); |
11 var newStyleAttr = document.createAttribute("STYLE"); | 11 var newStyleAttr = document.createAttribute("STYLE"); |
12 newStyleAttr.value = "background-color: green"; | 12 newStyleAttr.value = "background-color: green"; |
13 test.setAttributeNode(newStyleAttr); | 13 test.setAttributeNode(newStyleAttr); |
14 if (window.testRunner) { | 14 if (window.testRunner) { |
15 shouldBe("test.getAttribute('style')", "test.getAttribute('STYLE')"); | 15 shouldBe("test.getAttribute('style')", "test.getAttribute('STYLE')"); |
16 shouldBe("test.getAttributeNode('style').value", "test.getAttributeNode(
'STYLE').value"); | 16 shouldBe("test.getAttributeNode('style').value", "test.getAttributeNode(
'STYLE').value"); |
17 } | 17 } |
| 18 |
| 19 debug("Verifying that attributes with the same name but different namespaces
are treated as unique entities. For the following test two different attribute
values should be returned."); |
| 20 var newAttr1 = document.createAttributeNS("ns1", "newattr"); |
| 21 newAttr1.prefix = "prefix1"; |
| 22 newAttr1.value = "newattr1"; |
| 23 test.setAttributeNode(newAttr1); |
| 24 var newAttr2 = document.createAttributeNS("ns2", "newattr"); |
| 25 newAttr2.prefix = "prefix2"; |
| 26 newAttr2.value = "newattr2"; |
| 27 test.setAttributeNode(newAttr2); |
| 28 if (window.testRunner) { |
| 29 shouldBe("test.getAttributeNodeNS('ns1', 'newattr').value", "'newattr1'"
); |
| 30 shouldBe("test.getAttributeNodeNS('ns2', 'newattr').value", "'newattr2'"
); |
| 31 } |
| 32 |
| 33 debug("Verifying that attributes with same name but different case and havin
g same namespaces are treated as same. In the following test the new attribute s
hould overwrite the value of the existing one."); |
| 34 var newAttr3 = document.createAttributeNS("ns1", "NEWATTR"); |
| 35 newAttr3.prefix = "prefix2"; |
| 36 newAttr3.value = "newattr3"; |
| 37 test.setAttributeNode(newAttr3); |
| 38 |
| 39 if (window.testRunner) { |
| 40 shouldBe("test.getAttributeNodeNS('ns1', 'newattr').value", "'newattr3'"
); |
| 41 |
| 42 isSuccessfullyParsed(); |
| 43 test.style.display = 'none'; |
| 44 } |
| 45 |
18 } | 46 } |
19 </script> | 47 </script> |
20 </head> | 48 </head> |
21 <body onload="runTest()"> | 49 <body onload="runTest()"> |
22 <div>Test for Bugzilla bug:<a href="https://bugs.webkit.org/show_bug.cgi?id=9034
1"> 90341:</a> createAttribute/setAttributeNode does not properly normalize cas
e.</div> | 50 <div>Test for Bugzilla bug:<a href="https://bugs.webkit.org/show_bug.cgi?id=9034
1"> 90341:</a> createAttribute/setAttributeNode does not properly normalize cas
e.</div> |
23 <div id="test" style="background-color: red"> </div> | 51 <div id="test" style="background-color: red"> </div> |
24 <div id="description"></div> | 52 <div id="description"></div> |
25 <div id="console"></div> | 53 <div id="console"></div> |
26 </body> | 54 </body> |
27 </html> | 55 </html> |
OLD | NEW |