blob: becbc8a90b912e300c3dadb3f9f604b66ec1d558 [file] [log] [blame]
<html>
<head>
<script>
function log(msg) {
document.getElementById('log').appendChild(document.createTextNode(msg + '\n'));
}
function test() {
if (window.layoutTestController) {
layoutTestController.dumpAsText();
}
window.onfocus = function() { log('main frame focused'); }
window.onblur = function() { log('main frame blurred'); }
var input = document.getElementsByTagName('input')[0];
input.onfocus = function() { log('<input> focused'); }
input.onblur = function() { log ('<input> blurred'); }
var w = document.getElementById('frame').contentWindow;
w.onfocus = function() { log('iframe focused'); }
w.onblur = function() { log('iframe blurred'); }
var inputInIframe = w.document.getElementsByTagName('input')[0];
inputInIframe.onfocus = function() { log('<input> in iframe focused'); }
inputInIframe.onblur = function() { log ('<input> in frame blurred'); }
input.focus();
inputInIframe.focus();
input.focus();
}
</script>
</head>
<body onload="test()">
<input>
<iframe id="frame" src='javascript:"<input>"' style="width: 100px; height: 100px; margin: 0px; border: 2px solid black;"></iframe>
<p>This page tests that frames receive focus events when one of their child
elements is programmatically focused, and receive blur events when an
element not in that frame is programmatically focused.</p>
<pre id="log"></pre>
</body>
</html>