Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / PerformanceTests / DOM / div-editable.html
blob26ced3285a4433575a0c859a52751e56254b3310
1 <!DOCTYPE html>
2 <script src="../resources/runner.js"></script>
3 <div id="container" style="background-color:lime;" contenteditable></div>
4 <script>
5 var div = document.querySelector('div');
6 div.focus();
8 PerfTestRunner.measureRunsPerSecond({
9 description: "Measures performance of adding new lines to an editable div using document.execCommand, then clearing it.",
10 run: function() {
11 for (var i = 0; i < 500; ++i)
12 document.execCommand('InsertLineBreak');
13 for (var i = 0; i < 500; ++i)
14 document.execCommand('Delete');
16 for (var i = 0; i < 500; ++i)
17 document.execCommand('InsertLineBreak');
18 // Move cursor to the beginning of div.
19 var range = document.createRange();
20 range.selectNodeContents(div);
21 range.collapse(true);
22 getSelection().removeAllRanges();
23 getSelection().addRange(range);
24 for (var i = 0; i < 500; ++i)
25 document.execCommand('ForwardDelete');
27 });
28 </script>