3 <script src=
"../../../resources/js-test.js"></script>
4 <script src=
"../resources/common.js"></script>
6 var interactiveElements1
= ['button', 'details', 'embed', 'iframe', 'keygen', 'label', 'select', 'textarea'];
7 var interactiveElements2
= [
10 ['video', 'controls'],
15 var label
= document
.createElement('label');
16 document
.body
.appendChild(label
);
17 var control
= document
.createElement('input');
18 control
.id
= 'control';
19 label
.appendChild(control
);
21 interactiveElements1
.forEach(function(tag
) {
22 var element
= document
.createElement(tag
);
24 element
.style
.display
= 'block';
25 element
.style
.width
= '100px';
26 element
.style
.height
= '100px';
27 label
.appendChild(element
);
28 clickElement(element
);
30 shouldNotBe('document.activeElement.id', '"control"');
31 document
.activeElement
.blur();
32 label
.removeChild(element
);
36 interactiveElements2
.forEach(function(entry
) {
37 var element
= document
.createElement(entry
[0]);
38 element
.id
= entry
[0];
39 element
.style
.display
= 'block';
40 element
.style
.width
= '100px';
41 element
.style
.height
= '100px';
42 label
.appendChild(element
);
43 // Audio elements without controls attribute is always invisible.
44 if (entry
[0] != 'audio') {
45 clickElement(element
);
47 shouldBeEqualToString('document.activeElement.id', 'control');
49 document
.activeElement
.blur();
51 element
.setAttribute(entry
[1], entry
[1]);
52 // Prevents page transition.
54 element
.addEventListener('click', function(e
) { e
.preventDefault(); }, false);
55 clickElement(element
);
56 debug(entry
[0] + '[' + entry
[1] + ']');
57 shouldNotBe('document.activeElement.id', '"control"');
58 document
.activeElement
.blur();
59 label
.removeChild(element
);
62 var element
= document
.createElement('input');
64 element
.type
= 'text';
65 element
.style
.display
= 'block';
66 element
.style
.width
= '100px';
67 element
.style
.height
= '100px';
68 label
.appendChild(element
);
69 clickElement(element
);
71 shouldNotBe('document.activeElement.id', '"control"');
72 document
.activeElement
.blur();
74 // Note: It's impossible to click on input[type=hidden].