| <!DOCTYPE html> |
| <!-- Identical to "remove-child.html" but having 100 active ranges --> |
| <body> |
| <pre id="log"></pre> |
| <script src="../resources/runner.js"></script> |
| <div id="sandbox" style="display:none"></div> |
| <script> |
| var elems = []; |
| for (var i = 0; i < 50000; ++i) |
| elems[i] = document.createElement('div'); |
| |
| var ranges = []; |
| for (var i = 0; i < 1000; ++i) { |
| var range = new Range(); |
| ranges[i] = range; |
| range.selectNodeContents(document.body); |
| } |
| |
| var sandbox = document.getElementById('sandbox'); |
| |
| PerfTestRunner.measureRunsPerSecond({ |
| description: 'Measures performance of removeChild with active Range objects', |
| run: function() { |
| for (var elem of elems) |
| sandbox.appendChild(elem); |
| while (sandbox.firstChild) |
| sandbox.firstChild.remove(); |
| } |
| }); |
| </script> |
| </body> |