2011-06-16 Julien Chaffraix <jchaffraix@webkit.org>
[WebKit-https.git] / LayoutTests / perf / table-rows-length-caching.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <div id='sandbox'></div>
5 <div id="console"></div>
6 <script src="../resources/magnitude-perf.js"></script>
7 <script>
8
9 if (window.layoutTestController)
10     layoutTestController.dumpAsText();
11
12 var table;
13 var sandbox = document.getElementById('sandbox');
14
15 // Check that table.rows.length is properly cached.
16
17 function setupTableRows(magnitude)
18 {
19     if (sandbox.firstChild)
20         sandbox.removeChild(sandbox.firstChild);
21     table = document.createElement('table');
22
23     for (var i = 0; i < magnitude; ++i) {
24         var tr = document.createElement('tr');
25         table.appendChild(tr);
26     }
27     sandbox.appendChild(table);
28
29     // Make sure we have cached the length before testing!
30     table.rows.length;
31 }
32
33 function testTableRows(magnitude)
34 {
35     table.rows.length;
36 }
37
38 Magnitude.description('Tests that check that table.row.length is properly cached');
39 Magnitude.run(setupTableRows, testTableRows, Magnitude.CONSTANT);
40 sandbox.removeChild(sandbox.firstChild);
41 </script>
42 </body>
43 </html>