|
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 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=675166">Mozilla Bug 675166</a> |
|
13 <p id="display"></p> |
|
14 <div id="content" style="display: none"> |
|
15 |
|
16 </div> |
|
17 <pre id="test"> |
|
18 <script type="application/javascript"> |
|
19 |
|
20 /** Test for Bug 675166 **/ |
|
21 |
|
22 |
|
23 var dt = document.implementation.createDocumentType("html", null, null); |
|
24 isnot(dt.ownerDocument, null, "DocumentType should have ownerDocument"); |
|
25 |
|
26 var d = document.implementation.createDocument(null, null, dt); |
|
27 is(dt.ownerDocument, d, "DocumentType shouldn't have null ownerDocument"); |
|
28 |
|
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!"); |
|
34 } |
|
35 |
|
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"); |
|
40 |
|
41 is(document.ownerDocument, null, "Document's ownerDocument should be null!"); |
|
42 is(document.documentElement.ownerDocument, document, |
|
43 "Element should have ownerDocument!") |
|
44 |
|
45 is(dt2.parentNode, d2, "parentNode should be document!"); |
|
46 d2.removeChild(dt2); |
|
47 is(dt2.parentNode, null, "parentNode should be null!"); |
|
48 |
|
49 d.adoptNode(dt2); |
|
50 d2.adoptNode(dt2); |
|
51 d2.appendChild(dt2); |
|
52 is(dt2.parentNode, d2, "parentNode should be document!"); |
|
53 |
|
54 </script> |
|
55 </pre> |
|
56 </body> |
|
57 </html> |