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

Side by Side Diff: samples/third_party/dromaeo/tests/dom-traverse-dom.dart

Issue 10910013: Remove instances of dart:dom_deprecated from outside of lib/html and lib/dom. Part 1 of many. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months 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
OLDNEW
(Empty)
1 #library("dom_traverse");
2 #import("dart:dom_deprecated");
3 #import('../common/common.dart');
4 #import("dart:math", prefix: "Math");
5 #source("Common.dart");
6 #source("RunnerSuite.dart");
7
8
9 void main() {
10 final int num = 40;
11
12 // Try to force real results.
13 var ret;
14
15 String html = document.body.innerHTML;
16
17 new Suite(window, 'dom-traverse')
18 .prep(() {
19 html = BenchUtil.replaceAll(html, 'id="test(\\w).*?"', (Match match) {
20 final group = match.group(1);
21 return 'id="test${group}${num}"';
22 });
23 html = BenchUtil.replaceAll(html, 'name="test.*?"', (Match match) {
24 return 'name="test${num}"';
25 });
26 html = BenchUtil.replaceAll(html, 'class="foo.*?"', (Match match) {
27 return 'class="foo test${num} bar"';
28 });
29
30 final div = document.createElement('div');
31 div.innerHTML = html;
32 document.body.appendChild(div);
33 })
34 .test('firstChild', () {
35 final nodes = document.body.childNodes;
36 final nl = nodes.length;
37
38 for (int i = 0; i < num; i++) {
39 for (int j = 0; j < nl; j++) {
40 Node cur = nodes[j];
41 while (cur !== null) {
42 cur = cur.firstChild;
43 }
44 ret = cur;
45 }
46 }
47 })
48 .test('lastChild', () {
49 final nodes = document.body.childNodes;
50 final nl = nodes.length;
51
52 for (int i = 0; i < num; i++) {
53 for (int j = 0; j < nl; j++) {
54 Node cur = nodes[j];
55 while (cur !== null) {
56 cur = cur.lastChild;
57 }
58 ret = cur;
59 }
60 }
61 })
62 .test('nextSibling', () {
63 for (int i = 0; i < num * 2; i++) {
64 Node cur = document.body.firstChild;
65 while (cur !== null) {
66 cur = cur.nextSibling;
67 }
68 ret = cur;
69 }
70 })
71 .test('previousSibling', () {
72 for (int i = 0; i < num * 2; i++) {
73 Node cur = document.body.lastChild;
74 while (cur !== null) {
75 cur = cur.previousSibling;
76 }
77 ret = cur;
78 }
79 })
80 .test('childNodes', () {
81 for (int i = 0; i < num; i++) {
82 final nodes = document.body.childNodes;
83 for (int j = 0; j < nodes.length; j++) {
84 ret = nodes[j];
85 }
86 }
87 })
88 .end();
89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698