1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/test_bug675166.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,57 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=675166 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 675166</title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.13 +</head> 1.14 +<body> 1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=675166">Mozilla Bug 675166</a> 1.16 +<p id="display"></p> 1.17 +<div id="content" style="display: none"> 1.18 + 1.19 +</div> 1.20 +<pre id="test"> 1.21 +<script type="application/javascript"> 1.22 + 1.23 +/** Test for Bug 675166 **/ 1.24 + 1.25 + 1.26 +var dt = document.implementation.createDocumentType("html", null, null); 1.27 +isnot(dt.ownerDocument, null, "DocumentType should have ownerDocument"); 1.28 + 1.29 +var d = document.implementation.createDocument(null, null, dt); 1.30 +is(dt.ownerDocument, d, "DocumentType shouldn't have null ownerDocument"); 1.31 + 1.32 +try { 1.33 + document.implementation.createDocument(null, null, dt); 1.34 + ok(true, "Creating document using already bound document type shouldn't throw!"); 1.35 +} catch(ex) { 1.36 + ok(false, "Creating document using already bound document type shouldn't throw!"); 1.37 +} 1.38 + 1.39 +var d2 = document.implementation.createDocument(null, null, null); 1.40 +var dt2 = document.implementation.createDocumentType("html", null, null); 1.41 +d2.appendChild(dt2); 1.42 +is(dt2.ownerDocument, d2, "DocumentType shouldn't have null ownerDocument"); 1.43 + 1.44 +is(document.ownerDocument, null, "Document's ownerDocument should be null!"); 1.45 +is(document.documentElement.ownerDocument, document, 1.46 + "Element should have ownerDocument!") 1.47 + 1.48 +is(dt2.parentNode, d2, "parentNode should be document!"); 1.49 +d2.removeChild(dt2); 1.50 +is(dt2.parentNode, null, "parentNode should be null!"); 1.51 + 1.52 +d.adoptNode(dt2); 1.53 +d2.adoptNode(dt2); 1.54 +d2.appendChild(dt2); 1.55 +is(dt2.parentNode, d2, "parentNode should be document!"); 1.56 + 1.57 +</script> 1.58 +</pre> 1.59 +</body> 1.60 +</html>