OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <body> |
| 3 <script src="../../js/resources/js-test-pre.js"></script> |
| 4 |
| 5 <div id="f1"> |
| 6 <div tabindex="1" id="div1"></div> |
| 7 </div> |
| 8 |
| 9 <script type="text/javascript"> |
| 10 description('Making a focused element invisible should make it blur.'); |
| 11 jsTestIsAsync = true; |
| 12 var focusTarget = document.getElementById('div1'); |
| 13 var testStage = 0; |
| 14 |
| 15 document.body.onload = function() { |
| 16 focusTarget.focus(); |
| 17 |
| 18 shouldBe('document.activeElement', 'focusTarget', true); |
| 19 debug('===> Setting display:none'); |
| 20 f1.style.display = 'none'; |
| 21 |
| 22 setTimeout(function() { |
| 23 testFailed('Timeout: Didn\'t loose focus.'); |
| 24 finishJSTest(); |
| 25 }, 1000); |
| 26 }; |
| 27 |
| 28 focusTarget.addEventListener('blur', function() { |
| 29 debug('Event: blur'); |
| 30 shouldBe('document.activeElement', 'document.body'); |
| 31 testPassed('The focusTarget element lost focus.'); |
| 32 |
| 33 debug(''); |
| 34 if (testStage++ == 0) { |
| 35 f1.style.display = 'block'; |
| 36 focusTarget.focus(); |
| 37 shouldBe('document.activeElement', 'focusTarget', true); |
| 38 debug('===> Setting visibility:hidden'); |
| 39 f1.style.visibility = 'hidden'; |
| 40 } else |
| 41 finishJSTest(); |
| 42 }, false); |
| 43 |
| 44 </script> |
| 45 <script src="../../js/resources/js-test-post.js"></script> |
| 46 </body> |
OLD | NEW |