display-change-iframe.html (1298B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org"> 4 <link rel="help" href="https://www.w3.org/TR/css-display-3/#outer-role"> 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#replaced-elements"> 6 <link rel="match" href="../reference/ref-filled-green-100px-square.xht"> 7 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 8 <iframe id="victim" src="support/red-square.html" style="width:100px; height:100px; border:none;"></iframe> 9 <script> 10 var loaded_once = false; 11 victim.onload = function() { 12 // The child document should only load once. It should not be reloaded 13 // by changing the display type of the IFRAME. 14 if (loaded_once) 15 return; 16 loaded_once = true; 17 var childDoc = victim.contentWindow.document; 18 // Change the red background to green. This will revert back to red if 19 // the document gets reloaded (which shouldn't happen) when re-attaching 20 // #victim. 21 childDoc.getElementById("square").style.background = "green"; 22 document.offsetTop; 23 victim.style.display = "block"; 24 document.documentElement.className = ""; 25 } 26 </script> 27 </html>