pageload-image-in-popup.html (1276B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Media documents: image</title> 5 <link rel="author" title="Takayoshi Kochi" href="mailto:kochi@chromium.org"> 6 <link rel="author" title="Michael Ventnor" href="mailto:mventnor@mozilla.com"> 7 <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> 8 <link rel="help" href="https://html.spec.whatwg.org/multipage/#read-media"> 9 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharnessreport.js"></script> 11 12 <script> 13 var t = async_test("The document for a standalone media file should have one child in the body."); 14 15 var imgwin = window.open('/images/blue.png'); 16 imgwin.onload = t.step_func_done(function() { 17 assert_equals(imgwin.opener, window); 18 assert_equals(imgwin.document.contentType, "image/png"); 19 var imgwinChildren = imgwin.document.body.childNodes; 20 assert_equals(imgwinChildren.length, 1, "Body of image document has 1 child"); 21 assert_equals(imgwinChildren[0].nodeName, "IMG", "Only child of body must be an <img> element"); 22 assert_equals(imgwinChildren[0].namespaceURI, "http://www.w3.org/1999/xhtml", 23 "Only child of body must be an HTML element"); 24 imgwin.close(); 25 }); 26 </script> 27 </head> 28 <body> 29 <div id="log"></div> 30 </body> 31 </html>