activeelement-after-calling-window-focus-middle.sub.html (921B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>Focus test middle document</title> 4 <h1>Middle</h1><br> 5 <iframe allow="focus-without-user-activation" src="https://{{hosts[][www]}}:{{ports[https][0]}}/focus/support/activeelement-after-calling-window-focus-inner.html"></iframe> 6 <script> 7 let middlelog = "middlelog:"; 8 9 let iframe = document.querySelector("iframe"); 10 window.onmessage = function(e) { 11 if (e.data == "ready") { 12 parent.postMessage(e.data, "*"); 13 } else if (e.data == "focusinnerinput" || e.data == "focusinner" || e.data == "getlog") { 14 iframe.contentWindow.postMessage(e.data, "*"); 15 } else if (e.data == "focusmiddle") { 16 window.focus(); 17 middlelog += document.activeElement.tagName + ","; 18 } else { 19 parent.postMessage(middlelog + e.data, "*"); 20 } 21 }; 22 23 window.onfocus = function() { 24 middlelog += "windowfocus,"; 25 }; 26 27 window.onblur = function() { 28 middlelog += "windowblur,"; 29 }; 30 </script>