Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / base / test / test_bug675166.html
blob9543eb4e1f75b48a9bba936be8aa17f700bb2e7d
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=675166
5 -->
6 <head>
7 <title>Test for Bug 675166</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=675166">Mozilla Bug 675166</a>
13 <p id="display"></p>
14 <div id="content" style="display: none">
16 </div>
17 <pre id="test">
18 <script type="application/javascript">
20 /** Test for Bug 675166 **/
23 var dt = document.implementation.createDocumentType("html", null, null);
24 isnot(dt.ownerDocument, null, "DocumentType should have ownerDocument");
26 var d = document.implementation.createDocument(null, null, dt);
27 is(dt.ownerDocument, d, "DocumentType shouldn't have null ownerDocument");
29 try {
30 document.implementation.createDocument(null, null, dt);
31 ok(true, "Creating document using already bound document type shouldn't throw!");
32 } catch(ex) {
33 ok(false, "Creating document using already bound document type shouldn't throw!");
36 var d2 = document.implementation.createDocument(null, null, null);
37 var dt2 = document.implementation.createDocumentType("html", null, null);
38 d2.appendChild(dt2);
39 is(dt2.ownerDocument, d2, "DocumentType shouldn't have null ownerDocument");
41 is(document.ownerDocument, null, "Document's ownerDocument should be null!");
42 is(document.documentElement.ownerDocument, document,
43 "Element should have ownerDocument!")
45 is(dt2.parentNode, d2, "parentNode should be document!");
46 d2.removeChild(dt2);
47 is(dt2.parentNode, null, "parentNode should be null!");
49 d.adoptNode(dt2);
50 d2.adoptNode(dt2);
51 d2.appendChild(dt2);
52 is(dt2.parentNode, d2, "parentNode should be document!");
54 </script>
55 </pre>
56 </body>
57 </html>