test_child_document.html (2925B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8" /> 5 <title>Page Visibility API Child Document Test</title> 6 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script type="text/javascript" src="resources/pagevistestharness.js"></script> 10 11 <style type="text/css"> 12 iframe 13 { 14 width:250px; 15 height:250px; 16 margin-left:5px; 17 } 18 19 div.docs 20 { 21 position:relative; 22 float:left; 23 text-align:center; 24 margin:10px; 25 border:solid 1px black; 26 padding:3px; 27 } 28 </style> 29 30 <script type="text/javascript" > 31 setup({explicit_done: true}); 32 33 function onload_test() 34 { 35 pv_test(); 36 37 var frames = document.getElementsByTagName("iframe"); 38 var doc, doc_name; 39 40 for (var i = 0; i < frames.length; i++) 41 { 42 doc = frames[i].contentDocument; 43 doc_name = "IFrame with " + frames[i].id; 44 45 pv_test(function() 46 { 47 test_feature_exists(doc, " for frame with " + frames[i].id); 48 }); 49 50 test_equals(doc.visibilityState, VISIBILITY_STATES.VISIBLE, 51 "document.visibilityState for frame with " + 52 frames[i].id + " == " + 53 VISIBILITY_STATES.VISIBLE); 54 } 55 56 done(); 57 } 58 </script> 59 </head> 60 <body onload="onload_test()"> 61 <h1>Description</h1> 62 <p>This test validates that, within child documents, all of the Page Visibility API attributes exist, 63 are read-only, and match the value of the attributes within the parent document.</p> 64 65 <div id="log"></div> 66 67 <br/> 68 69 <div class="docs"> 70 IFrame with no style attribute 71 <br/> 72 <iframe id="no style attribute" src="resources/blank_page_green.html"> 73 iframes unsupported 74 </iframe> 75 </div> 76 77 <div class="docs"> 78 IFrame with "display:none" style<br/> 79 <iframe id="'display:none' style" style="display:none" 80 src="resources/blank_page_green.html"> 81 iframes unsupported 82 </iframe> 83 </div> 84 85 <div class="docs"> 86 IFrame with "visibility:hidden" style 87 <br/> 88 <iframe id="'visibility:hidden' style" style="visibility:hidden" 89 src="resources/blank_page_green.html"> 90 iframes unsupported 91 </iframe> 92 </div> 93 </body> 94 </html>