Bug 1776680 [wpt PR 34603] - [@container] Test invalidation of font-relative units...
[gecko.git] / dom / events / test / test_bug288392.html
blobf50327eed333226cb6109200f224c353eb8d615c
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=288392
5 -->
6 <head>
7 <title>Test for Bug 288392</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=288392">Mozilla Bug 288392</a>
13 <p id="display"></p>
14 <div id="content" style="display: none">
15 <div id="mutationTarget">
16 </div>
17 </div>
18 <pre id="test">
19 <script class="testbody" type="text/javascript">
21 /** Test for Bug 288392 **/
22 var subtreeModifiedCount;
24 function subtreeModified(e)
26 ++subtreeModifiedCount;
29 function doTest() {
30 var targetNode = document.getElementById("mutationTarget");
31 targetNode.addEventListener("DOMSubtreeModified", subtreeModified);
33 subtreeModifiedCount = 0;
34 var temp = document.createElement("DIV");
35 targetNode.appendChild(temp);
36 is(subtreeModifiedCount, 1,
37 "Appending a child node should have dispatched a DOMSubtreeModified event");
39 subtreeModifiedCount = 0;
40 temp.setAttribute("foo", "bar");
41 is(subtreeModifiedCount, 1,
42 "Setting an attribute should have dispatched a DOMSubtreeModified event");
44 subtreeModifiedCount = 0;
45 targetNode.removeChild(temp);
46 is(subtreeModifiedCount, 1,
47 "Removing a child node should have dispatched a DOMSubtreeModified event");
49 // Testing events in a subtree, which is not in the document.
50 var subtree = document.createElement("div");
51 var s = "<e1 attr1='value1'>Something1</e1><e2 attr2='value2'>Something2</e2>";
52 subtree.innerHTML = s;
53 subtree.addEventListener("DOMSubtreeModified", subtreeModified);
55 subtreeModifiedCount = 0;
56 subtree.firstChild.firstChild.data = "foo";
57 is(subtreeModifiedCount, 1,
58 "Editing character data should have dispatched a DOMSubtreeModified event");
60 subtreeModifiedCount = 0;
61 subtree.firstChild.removeChild(subtree.firstChild.firstChild);
62 is(subtreeModifiedCount, 1,
63 "Removing a child node should have dispatched a DOMSubtreeModified event");
65 subtree.innerHTML = s;
66 subtreeModifiedCount = 0;
67 subtree.firstChild.firstChild.remove();
68 is(subtreeModifiedCount, 1,
69 "Removing a child node should have dispatched a DOMSubtreeModified event");
71 subtreeModifiedCount = 0;
72 subtree.firstChild.setAttribute("foo", "bar");
73 is(subtreeModifiedCount, 1,
74 "Setting an attribute should have dispatched a DOMSubtreeModified event");
76 subtreeModifiedCount = 0;
77 subtree.textContent = "foobar";
78 is(subtreeModifiedCount, 1,
79 "Setting .textContent should have dispatched a DOMSubtreeModified event");
81 subtreeModifiedCount = 0;
82 subtree.innerHTML = s;
83 is(subtreeModifiedCount, 1,
84 "Setting .innerHTML should have dispatched a DOMSubtreeModified event");
86 subtreeModifiedCount = 0;
87 subtree.removeEventListener("DOMSubtreeModified", subtreeModified);
88 subtree.appendChild(document.createTextNode(""));
89 subtree.addEventListener("DOMSubtreeModified", subtreeModified);
90 subtree.normalize();
91 is(subtreeModifiedCount, 1,
92 "Calling normalize() should have dispatched a DOMSubtreeModified event");
95 SimpleTest.waitForExplicitFinish();
96 addLoadEvent(doTest);
97 addLoadEvent(SimpleTest.finish);
99 </script>
100 </pre>
101 </body>
102 </html>