| OLD | NEW |
| 1 class Main { | 1 class Main { |
| 2 static void main() { | 2 static void main() { |
| 3 final int num = 40; | 3 final int num = 40; |
| 4 | 4 |
| 5 // Try to force real results. | 5 // Try to force real results. |
| 6 var ret; | 6 var ret; |
| 7 window.on.load.add((Event evt) { | 7 window.on.load.add((Event evt) { |
| 8 String html = document.body.innerHTML; | 8 String html = document.body.innerHTML; |
| 9 | 9 |
| 10 new Suite('dom-query') | 10 new Suite('dom-query') |
| 11 .prep(() { | 11 .prep(() { |
| 12 html = BenchUtil.replaceAll(html, 'id="test(\\w).*?"', (Match match) { | 12 html = BenchUtil.replaceAll(html, 'id="test(\\w).*?"', (Match match) { |
| 13 final group = match.group(1); | 13 final group = match.group(1); |
| 14 return 'id="test${group}${num}"'; | 14 return 'id="test${group}${num}"'; |
| 15 }); | 15 }); |
| 16 html = BenchUtil.replaceAll(html, 'name="test.*?"', (Match match) { | 16 html = BenchUtil.replaceAll(html, 'name="test.*?"', (Match match) { |
| 17 return 'name="test${num}"'; | 17 return 'name="test${num}"'; |
| 18 }); | 18 }); |
| 19 html = BenchUtil.replaceAll(html, 'class="foo.*?"', (Match match) { | 19 html = BenchUtil.replaceAll(html, 'class="foo.*?"', (Match match) { |
| 20 return 'class="foo test${num} bar"'; | 20 return 'class="foo test${num} bar"'; |
| 21 }); | 21 }); |
| 22 final div = document.createElement('div'); | 22 final div = new Element.tag('div'); |
| 23 div.innerHTML = html; | 23 div.innerHTML = html; |
| 24 document.body.nodes.add(div); | 24 document.body.nodes.add(div); |
| 25 }) | 25 }) |
| 26 .test('getElementById', () { | 26 .test('getElementById', () { |
| 27 for (int i = 0; i < num * 30; i++) { | 27 for (int i = 0; i < num * 30; i++) { |
| 28 ret = document.query('#testA' + num).tagName; | 28 ret = document.query('#testA' + num).tagName; |
| 29 ret = document.query('#testB' + num).tagName; | 29 ret = document.query('#testB' + num).tagName; |
| 30 ret = document.query('#testC' + num).tagName; | 30 ret = document.query('#testC' + num).tagName; |
| 31 ret = document.query('#testD' + num).tagName; | 31 ret = document.query('#testD' + num).tagName; |
| 32 ret = document.query('#testE' + num).tagName; | 32 ret = document.query('#testE' + num).tagName; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 ret = document.queryAll('[name=test]').length == 0; | 92 ret = document.queryAll('[name=test]').length == 0; |
| 93 ret = document.queryAll('[name=test]').length == 0; | 93 ret = document.queryAll('[name=test]').length == 0; |
| 94 ret = document.queryAll('[name=test]').length == 0; | 94 ret = document.queryAll('[name=test]').length == 0; |
| 95 } | 95 } |
| 96 }) | 96 }) |
| 97 .end(); | 97 .end(); |
| 98 }); | 98 }); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| OLD | NEW |