Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <!--
3 https://bugzilla.mozilla.org/show_bug.cgi?id=339494
4 -->
5 <head>
6 <title>Test for Bug 339494</title>
7 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
9 </head>
10 <body>
11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=339494">Mozilla Bug 339494</a>
12 <p id="display"></p>
13 <div id="content" style="display: none">
14 <div id="d" />
15 <div id="s" />
16 </div>
17 <pre id="test">
18 <script class="testbody" type="text/javascript">
20 /** Test for Bug 339494 **/
22 var d = document.getElementById("d");
24 d.setAttribute("hhh", "testvalue");
26 document.addEventListener("DOMAttrModified", removeItAgain, false);
27 d.removeAttribute("hhh");
28 document.removeEventListener("DOMAttrModified", removeItAgain, false);
30 function removeItAgain()
31 {
32 ok(!d.hasAttribute("hhh"), "Value check 1",
33 "There should be no value");
34 isnot(d.getAttribute("hhh"), "testvalue", "Value check 2");
35 document.removeEventListener("DOMAttrModified", removeItAgain, false);
36 d.removeAttribute("hhh");
37 ok(true, "Reachability", "We shouldn't have crashed");
38 }
40 var s = document.getElementById("s");
42 s.setAttribute("ggg", "testvalue");
44 document.addEventListener("DOMAttrModified", compareVal, false);
45 s.setAttribute("ggg", "othervalue");
46 document.removeEventListener("DOMAttrModified", compareVal, false);
48 function compareVal()
49 {
50 ok(s.hasAttribute("ggg"), "Value check 3",
51 "There should be a value");
52 isnot(s.getAttribute("ggg"), "testvalue", "Value check 4");
53 is(s.getAttribute("ggg"), "othervalue", "Value check 5");
54 }
56 </script>
57 </pre>
58 </body>
59 </html>