2 This file is used as a control test to compare with the other Chrome Endure
3 tests in perf_endure.py.
5 This file provides the ability to attach/detach a large DOM tree (also
6 containing event listeners) in the live document. It is meant to be the same
7 as endurance_control.html, except it provides buttons that can be clicked to
8 cause the DOM tree to be attached/detached. This allows a control scenario
9 to be driven by WebDriver, rather than being driven by the Javascript itself.
14 <script type='text/javascript'
>
16 function attach_dom_tree() {
17 var last_node
= document
.createElement('div');
18 last_node
.id
= 'root_node';
19 var root_node
= last_node
;
20 for (i
= 0; i
< 1000; ++i
) {
21 var node
= document
.createElement('div');
22 node
.innerHTML
= 'Node ' + i
;
23 node
.addEventListener('mousemove', mouse_move_callback
, true);
24 last_node
.appendChild(node
);
27 document
.body
.appendChild(root_node
);
30 function detach_dom_tree() {
31 var root_node
= document
.getElementById('root_node');
32 document
.body
.removeChild(root_node
);
35 function mouse_move_callback(event
) {
39 <title>Chrome Endure Control Test with WebDriver
</title>
42 <input type=
"button" id=
"attach" value=
"attach"
43 onclick=
"attach_dom_tree();" />
44 <input type=
"button" id=
"detach" value=
"detach"
45 onclick=
"detach_dom_tree();" />