3 <script src=
"../../resources/js-test.js"></script>
13 function handleKeydown(event
) {
14 event
.target
.style
.width
= '0px';
17 function handleBlur(event
) {
18 testFailed('Event: blur');
19 event
.target
.style
.width
= '';
22 window
.onload = function() {
23 debug('Check if a control won\'t loose focus when it becomes 0-size.');
25 input1
.addEventListener('keydown', handleKeydown
, false);
26 input1
.addEventListener('blur', handleBlur
, false);
27 eventSender
.keyDown('0');
28 event
.target
.removeEventListener('keydown', handleKeydown
);
33 // We need to check activeElement twice because
34 // FrameSelection::setFocusedNodeIfNeeded can change focus.
35 shouldBe('document.activeElement', 'input1');
36 eventSender
.keyDown('1');
37 shouldBeEqualToString('input1.value', '01');
38 shouldBe('document.activeElement', 'input1');
41 debug('Check if 0-size control can get focus.');
42 input1
.removeEventListener('blur', handleBlur
);
44 shouldBe('document.activeElement', 'document.body', true);
45 input1
.style
.height
= '0px';
46 shouldBe('input1.offsetHeight', '0', true);
48 shouldBe('document.activeElement', 'input1');