Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / base / test / test_bug1075702.html
bloba3842a21a5e71488fcc97719e508e4f3f27cc9d5
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=1075702
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title> Test for Bug 1075702 </title>
9 <script src="/tests/SimpleTest/SimpleTest.js"> </script>
10 <script src="/tests/SimpleTest/EventUtils.js"> </script>
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
12 </head>
13 <body>
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1075702"> Mozilla Bug 1075702 </a>
15 <p id="display"></p>
17 <pre id="test">
18 <script type="application/javascript">
20 /** Test for Bug 1075702 **/
21 // test: Element.removeAttributeNode()
23 var a1 = document.createAttribute("aa");
24 a1.nodeValue = "lowercase";
26 var a2 = document.createAttributeNS("", "AA");
27 a2.nodeValue = "UPPERCASE";
29 document.documentElement.setAttributeNode(a1);
30 document.documentElement.setAttributeNode(a2);
32 is(document.documentElement.getAttributeNS("", "aa"), "lowercase", "Should be lowercase!");
33 is(document.documentElement.getAttributeNS("", "AA"), "UPPERCASE", "Should be UPPERCASE!");
35 var a3 = document.createAttribute("AA");
36 a3.nodeValue = "UPPERCASE AGAIN";
37 document.documentElement.setAttributeNode(a3);
39 is(document.documentElement.getAttributeNS("", "aa"), "UPPERCASE AGAIN",
40 "Should be UPPERCASE AGAIN!");
41 is(document.documentElement.getAttributeNS("", "AA"), "UPPERCASE", "Should be UPPERCASE!");
43 var removedNodeAccordingToEvent;
45 function mutationHandler(aEvent) {
46 removedNodeAccordingToEvent = aEvent.relatedNode;
49 var test1 = document.createElement("div");
50 test1.setAttribute("x", "y");
51 removedNodeAccordingToEvent = null;
53 function testremoveNamedItemNS() {
54 test1.addEventListener("DOMAttrModified", mutationHandler, true);
55 var removedNodeAccordingToRemoveNamedItemNS = test1.attributes.removeNamedItemNS(null, "x");
56 test1.removeEventListener("DOMAttrModified", mutationHandler, true);
57 is(removedNodeAccordingToEvent, removedNodeAccordingToRemoveNamedItemNS, "Node removed according to event is not same as node removed by removeNamedItemNS.");
60 testremoveNamedItemNS();
62 var test2 = document.createElement("div");
63 test2.setAttribute("x", "y");
64 removedNodeAccordingToEvent = null;
66 function testremoveNamedItem() {
67 test2.addEventListener("DOMAttrModified", mutationHandler, true);
68 var removedNodeAccordingToRemoveNamedItem = test2.attributes.removeNamedItem("x");
69 test2.removeEventListener("DOMAttrModified", mutationHandler, true);
70 is(removedNodeAccordingToEvent, removedNodeAccordingToRemoveNamedItem, "Node removed according to event is not same as node removed by removeNamedItem.");
73 testremoveNamedItem();
75 </script>
76 </body>
77 </html>