| OLD | NEW |
| (Empty) | |
| 1 <!doctype html> |
| 2 <script src="../resources/runner.js"></script> |
| 3 <div id="target">target</div> |
| 4 <div id="sample" style="display: none"></div> |
| 5 <script> |
| 6 var selection = window.getSelection(); |
| 7 selection.selectAllChildren(document.getElementById('target')); |
| 8 var sample = document.getElementById('sample'); |
| 9 for (var index = 0; index < 1000; ++index) { |
| 10 var span = document.createElement('span'); |
| 11 span.textContent = `item ${index}\n`; |
| 12 sample.appendChild(span); |
| 13 } |
| 14 PerfTestRunner.measureTime({ |
| 15 description: 'Measures performance of removeChild() with selection.', |
| 16 |
| 17 run: function() { |
| 18 var copy = sample.cloneNode(true); |
| 19 while (sample.firstChild) |
| 20 sample.removeChild(sample.firstChild); |
| 21 while (copy.firstChild) |
| 22 sample.appendChild(copy.firstChild); |
| 23 }, |
| 24 }); |
| 25 </script> |
| OLD | NEW |