OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <script src="../resources/runner.js"></script> |
| 3 <div id="sample"></div> |
| 4 <script> |
| 5 const kCount = 10; |
| 6 const kElements = 10000; |
| 7 |
| 8 const metaElements = (() => { |
| 9 const result = []; |
| 10 for (let count = 0; count < kElements; ++count) |
| 11 result.push('<meta>', '</meta>'); |
| 12 return result; |
| 13 })(); |
| 14 const sample = document.getElementById('sample'); |
| 15 sample.innerHTML = [ |
| 16 '<div hiddent>', ...metaElements, '</div>', |
| 17 '<h1 id="target">first line of renderered text</h1>', |
| 18 '<div hiddent>', ...metaElements, '</div>', |
| 19 ].join(''); |
| 20 |
| 21 const selection = window.getSelection(); |
| 22 const target = document.getElementById('target'); |
| 23 |
| 24 PerfTestRunner.measureRunsPerSecond({ |
| 25 description: 'Measures performance of move-up through non-renderered elements'
, |
| 26 run: () => { |
| 27 selection.collapse(target, 0); |
| 28 selection.extend(target, target.childNodes.length); |
| 29 for (let counter = 0; counter < kCount; ++counter) |
| 30 selection.modify('move', 'backward', 'line'); |
| 31 }, |
| 32 }); |
| 33 </script> |
OLD | NEW |