iframe_004.html (707B)
1 <!doctype html> 2 <title>document.write script into iframe write back into parent</title> 3 <script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> 4 <iframe id="test"></iframe> 5 <script> 6 var t = async_test(); 7 var iframe = document.getElementById("test"); 8 var order = []; 9 t.step(function() { 10 order.push(1); 11 var s = "<script>parent.order.push(2); parent.document.write('<script>order.push(3);</script'+'>'); parent.order.push(4)</script" + ">"; 12 for (var i=0; i<s.length; i++) { 13 iframe.contentDocument.write(s[i]); 14 } 15 iframe.contentDocument.close(); 16 order.push(5); 17 assert_array_equals(order, [1,2,3,4,5]) 18 } 19 ); 20 t.done(); 21 </script> 22 <div id="log"></div>