Document-defaultView.html (1161B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Document#defaultView</title> 4 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharnessreport.js></script> 6 <div id=log></div> 7 <script> 8 test(function() { 9 assert_equals(document.defaultView, window); 10 }, "Document in a browsing context"); 11 12 test(function() { 13 var d = new Document(); 14 assert_equals(d.defaultView, null); 15 }, "Document created with the Document constructor"); 16 17 test(function() { 18 var d = document.implementation.createDocument(null, null); 19 assert_equals(d.defaultView, null); 20 }, "Document created with createDocument"); 21 22 test(function() { 23 var d = document.implementation.createHTMLDocument(); 24 assert_equals(d.defaultView, null); 25 }, "Document created with createHTMLDocument"); 26 27 test(function() { 28 var parser = new DOMParser(); 29 var d = parser.parseFromString("<foo\/\>", "application/xml"); 30 assert_equals(d.defaultView, null); 31 }, "Document created with XML DOMParser"); 32 33 test(function() { 34 var parser = new DOMParser(); 35 var d = parser.parseFromString("bar", "text/html"); 36 assert_equals(d.defaultView, null); 37 }, "Document created with HTML DOMParser"); 38 </script>