Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / HTMLDocument / active-element-gets-unforcusable.html
blob9500cc99f80b4a5867440dca67fdc49bbf3b5928
1 <!DOCTYPE html>
2 <body>
3 <script src="../../../resources/js-test.js"></script>
5 <div id="f1">
6 <div tabindex="1" id="div1"></div>
7 </div>
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;
15 document.body.onload = function() {
16 focusTarget.focus();
18 shouldBe('document.activeElement', 'focusTarget', true);
19 debug('===> Setting display:none');
20 f1.style.display = 'none';
22 setTimeout(function() {
23 testFailed('Timeout: Didn\'t loose focus.');
24 finishJSTest();
25 }, 1000);
28 focusTarget.addEventListener('blur', function() {
29 debug('Event: blur');
30 shouldBe('document.activeElement', 'document.body');
31 testPassed('The focusTarget element lost focus.');
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);
44 </script>
45 </body>