4 <script src=
"../../resources/js-test.js"></script>
5 <iframe id=
"frame1" src=
"data:text/html,<input id='input'>" ></iframe>
6 <iframe id=
"frame2" src=
"data:text/html,<div>This is a iframe element</div>"></iframe>
8 description('Make sure that moving focus on an inactive frame fires blur event on existing element focus.');
11 window
.onload = function()
13 var frame1
= document
.getElementById('frame1');
14 var frame2
= document
.getElementById('frame2');
16 doc
= frame1
.contentDocument
;
17 input
= doc
.querySelector('input');
18 input
.onblur = function() {
19 testPassed('A blur event was dispatched on frame1 input element.');
21 input
.onfocus = function() {
22 testPassed('A focus event was dispatched on frame1 input element.');
26 debug('===> Making a first frame with a focused element inactive by focus() for second frame.');
27 frame2
.contentWindow
.focus();
28 shouldBe('frame1.contentDocument.activeElement', 'input');
29 debug('===> Making the first frame active again by focus() for first frame.');
30 frame1
.contentWindow
.focus();
31 shouldBe('frame1.contentDocument.activeElement', 'input');