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 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=562652
5 -->
6 <head>
7 <title>Test for Bug 562652</title>
8 <script type="application/javascript" 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=562652">Mozilla Bug 562652</a>
13 <p id="display"></p>
14 <div id="content" style="display: none">
16 </div>
17 <div id="testtarget">_</div>
18 <pre id="test">
19 <script type="application/javascript">
21 /** Test for Bug 562652 **/
24 var testCount = 0;
25 function createHTMLDoc() {
26 var dtd = document.implementation.createDocumentType("HTML", "-//W3C//DTD HTML 4.01//EN", null);
27 var d = document.implementation.createDocument(null, null, dtd);
28 d.appendChild(d.createElement("html"));
29 d.documentElement.appendChild(d.createElement("body"));
30 d.body.setAttribute("id", "testtarget");
31 return d;
32 }
34 function test(d) {
35 var t = d.getElementById("testtarget");
36 d.addEventListener("DOMNodeInserted", function(e) { ++testCount; }, false);
37 t.innerHTML = "_";
38 }
40 function runTests() {
41 test(document);
42 test(createHTMLDoc());
43 is(testCount, 2, "DOMNodeInserted should have fired 2 times!");
44 SimpleTest.finish();
45 }
47 addLoadEvent(runTests);
49 SimpleTest.waitForExplicitFinish();
51 </script>
52 </pre>
53 </body>
54 </html>