OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <body> |
| 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>"></i
frame> |
| 7 <script> |
| 8 description('Make sure that moving focus on an inactive frame fires blur event o
n existing element focus.'); |
| 9 var doc; |
| 10 var input; |
| 11 window.onload = function() |
| 12 { |
| 13 var frame1 = document.getElementById('frame1'); |
| 14 var frame2 = document.getElementById('frame2'); |
| 15 |
| 16 doc = frame1.contentDocument; |
| 17 input = doc.querySelector('input'); |
| 18 input.onblur = function() { |
| 19 testPassed('A blur event was dispatched on frame1 input element.'); |
| 20 } |
| 21 input.onfocus = function() { |
| 22 testPassed('A focus event was dispatched on frame1 input element.'); |
| 23 } |
| 24 input.focus(); |
| 25 |
| 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'); |
| 32 } |
| 33 </script> |
| 34 </body> |
| 35 </html> |
OLD | NEW |