OLD | NEW |
---|---|
(Empty) | |
1 <!-- | |
2 This file is used as a control test to compare with the other Chrome Endure | |
3 tests in perf_endure.py. | |
4 | |
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. | |
10 --> | |
11 | |
12 <html> | |
13 <head> | |
14 <script type='text/javascript'> | |
15 | |
16 function attach_dom_tree() { | |
17 var last_node = document.createElement('div'); | |
18 var root_node = last_node; | |
19 for (i = 0; i < 1000; ++i) { | |
20 var node = document.createElement('div'); | |
21 node.innerHTML = 'Node ' + i; | |
22 node.addEventListener('mousemove', mouse_move_callback, true); | |
23 last_node.appendChild(node); | |
24 last_node = node; | |
25 } | |
26 document.body.appendChild(root_node); | |
27 } | |
28 | |
29 function detach_dom_tree() { | |
30 // The attached DOM tree occurs at child index 5 of document.body. | |
31 document.body.removeChild(document.body.childNodes[5]); | |
frankf1
2012/03/10 02:57:17
can you query the node by name instead of the posi
dennis_jeffrey
2012/03/12 18:48:07
Done - I gave the root node an ID.
| |
32 } | |
33 | |
34 function mouse_move_callback(event) { | |
35 // Stub. | |
36 } | |
37 </script> | |
38 <title>Chrome Endure Control Test with WebDriver</title> | |
39 </head> | |
40 <body> | |
41 <input type="button" id="attach" value="attach" | |
42 onclick="attach_dom_tree();" /> | |
43 <input type="button" id="detach" value="detach" | |
44 onclick="detach_dom_tree();" /> | |
45 </body> | |
46 </html> | |
OLD | NEW |