Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: client/dom/benchmarks/dromaeo/tests/dom-traverse.dart

Issue 8637013: Remove support for attribute event listeners. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/dom/benchmarks/dromaeo/tests/dom-query.dart ('k') | client/dom/generated/monkey_dom.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #library("dom-traverse.dart"); 1 #library("dom-traverse.dart");
2 #import("dart:dom"); 2 #import("dart:dom");
3 #import('../../common/common.dart'); 3 #import('../../common/common.dart');
4 #import('runner.dart'); 4 #import('runner.dart');
5 5
6 6
7 void main() { 7 void main() {
8 final int num = 40; 8 final int num = 40;
9 9
10 // Try to force real results. 10 // Try to force real results.
11 var ret; 11 var ret;
12 window.onload = (Event evt) {
13 String html = document.body.innerHTML;
14 12
15 new Suite(window, 'dom-traverse') 13 String html = document.body.innerHTML;
16 .prep(() {
17 html = BenchUtil.replaceAll(html, 'id="test(\\w).*?"', (Match match) {
18 final group = match.group(1);
19 return 'id="test${group}${num}"';
20 });
21 html = BenchUtil.replaceAll(html, 'name="test.*?"', (Match match) {
22 return 'name="test${num}"';
23 });
24 html = BenchUtil.replaceAll(html, 'class="foo.*?"', (Match match) {
25 return 'class="foo test${num} bar"';
26 });
27 14
28 final div = document.createElement('div'); 15 new Suite(window, 'dom-traverse')
29 div.innerHTML = html; 16 .prep(() {
30 document.body.appendChild(div); 17 html = BenchUtil.replaceAll(html, 'id="test(\\w).*?"', (Match match) {
31 }) 18 final group = match.group(1);
32 .test('firstChild', () { 19 return 'id="test${group}${num}"';
33 final nodes = document.body.childNodes; 20 });
34 final nl = nodes.length; 21 html = BenchUtil.replaceAll(html, 'name="test.*?"', (Match match) {
22 return 'name="test${num}"';
23 });
24 html = BenchUtil.replaceAll(html, 'class="foo.*?"', (Match match) {
25 return 'class="foo test${num} bar"';
26 });
35 27
36 for (int i = 0; i < num; i++) { 28 final div = document.createElement('div');
37 for (int j = 0; j < nl; j++) { 29 div.innerHTML = html;
38 Node cur = nodes[j]; 30 document.body.appendChild(div);
39 while (cur !== null) { 31 })
40 cur = cur.firstChild; 32 .test('firstChild', () {
41 } 33 final nodes = document.body.childNodes;
42 ret = cur; 34 final nl = nodes.length;
43 }
44 }
45 })
46 .test('lastChild', () {
47 final nodes = document.body.childNodes;
48 final nl = nodes.length;
49 35
50 for (int i = 0; i < num; i++) { 36 for (int i = 0; i < num; i++) {
51 for (int j = 0; j < nl; j++) { 37 for (int j = 0; j < nl; j++) {
52 Node cur = nodes[j]; 38 Node cur = nodes[j];
53 while (cur !== null) {
54 cur = cur.lastChild;
55 }
56 ret = cur;
57 }
58 }
59 })
60 .test('nextSibling', () {
61 for (int i = 0; i < num * 2; i++) {
62 Node cur = document.body.firstChild;
63 while (cur !== null) { 39 while (cur !== null) {
64 cur = cur.nextSibling; 40 cur = cur.firstChild;
65 } 41 }
66 ret = cur; 42 ret = cur;
67 } 43 }
68 }) 44 }
69 .test('previousSibling', () { 45 })
70 for (int i = 0; i < num * 2; i++) { 46 .test('lastChild', () {
71 Node cur = document.body.firstChild; 47 final nodes = document.body.childNodes;
48 final nl = nodes.length;
49
50 for (int i = 0; i < num; i++) {
51 for (int j = 0; j < nl; j++) {
52 Node cur = nodes[j];
72 while (cur !== null) { 53 while (cur !== null) {
73 cur = cur.previousSibling; 54 cur = cur.lastChild;
74 } 55 }
75 ret = cur; 56 ret = cur;
76 } 57 }
77 }) 58 }
78 .test('childNodes', () { 59 })
79 for (int i = 0; i < num; i++) { 60 .test('nextSibling', () {
80 final nodes = document.body.childNodes; 61 for (int i = 0; i < num * 2; i++) {
81 for (int j = 0; j < nodes.length; j++) { 62 Node cur = document.body.firstChild;
82 ret = nodes[j]; 63 while (cur !== null) {
83 } 64 cur = cur.nextSibling;
84 } 65 }
85 }) 66 ret = cur;
86 .end(); 67 }
87 }; 68 })
69 .test('previousSibling', () {
70 for (int i = 0; i < num * 2; i++) {
71 Node cur = document.body.firstChild;
72 while (cur !== null) {
73 cur = cur.previousSibling;
74 }
75 ret = cur;
76 }
77 })
78 .test('childNodes', () {
79 for (int i = 0; i < num; i++) {
80 final nodes = document.body.childNodes;
81 for (int j = 0; j < nodes.length; j++) {
82 ret = nodes[j];
83 }
84 }
85 })
86 .end();
88 } 87 }
OLDNEW
« no previous file with comments | « client/dom/benchmarks/dromaeo/tests/dom-query.dart ('k') | client/dom/generated/monkey_dom.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698