test-iframe.html (1096B)
1 <!doctype html> 2 <title>Selection test iframe</title> 3 <link rel=author title="Aryeh Gregor" href=ayg@aryeh.name> 4 <body> 5 <script src=common.js></script> 6 <script> 7 "use strict"; 8 9 // This script only exists because we want to evaluate the range endpoints 10 // in each iframe using that iframe's local variables set up by common.js. It 11 // just creates a range with the endpoints given by 12 // eval(window.testRangeInput), and assigns the result to window.testRange. If 13 // there's an exception, it's assigned to window.unexpectedException. 14 // Everything else is to be done by the script that created the iframe. 15 window.unexpectedException = null; 16 17 function run() { 18 window.unexpectedException = null; 19 try { 20 window.testRange = rangeFromEndpoints(eval(window.testRangeInput)); 21 } catch(e) { 22 window.unexpectedException = e; 23 } 24 } 25 26 // Remove the scripts so they don't run repeatedly when the iframe is 27 // reinitialized 28 [].forEach.call(document.querySelectorAll("script"), function(script) { 29 script.parentNode.removeChild(script); 30 }); 31 32 testDiv.style.display = "none"; 33 </script>