OLD | NEW |
1 library dom_traverse; | 1 library dom_traverse; |
2 import 'dart:html'; | 2 import 'dart:html'; |
3 import '../common/common.dart'; | 3 import '../common/common.dart'; |
4 import 'dart:math' as Math; | 4 import 'dart:math' as Math; |
5 part 'Common.dart'; | 5 part 'Common.dart'; |
6 part 'RunnerSuite.dart'; | 6 part 'RunnerSuite.dart'; |
7 | 7 |
8 | 8 |
9 void main() { | 9 void main() { |
10 final int num = 40; | 10 final int num = 40; |
(...skipping 20 matching lines...) Expand all Loading... |
31 div.innerHTML = html; | 31 div.innerHTML = html; |
32 document.body.$dom_appendChild(div); | 32 document.body.$dom_appendChild(div); |
33 }) | 33 }) |
34 .test('firstChild', () { | 34 .test('firstChild', () { |
35 final nodes = document.body.$dom_childNodes; | 35 final nodes = document.body.$dom_childNodes; |
36 final nl = nodes.length; | 36 final nl = nodes.length; |
37 | 37 |
38 for (int i = 0; i < num; i++) { | 38 for (int i = 0; i < num; i++) { |
39 for (int j = 0; j < nl; j++) { | 39 for (int j = 0; j < nl; j++) { |
40 Node cur = nodes[j]; | 40 Node cur = nodes[j]; |
41 while (cur !== null) { | 41 while (cur != null) { |
42 cur = cur.$dom_firstChild; | 42 cur = cur.$dom_firstChild; |
43 } | 43 } |
44 ret = cur; | 44 ret = cur; |
45 } | 45 } |
46 } | 46 } |
47 }) | 47 }) |
48 .test('lastChild', () { | 48 .test('lastChild', () { |
49 final nodes = document.body.$dom_childNodes; | 49 final nodes = document.body.$dom_childNodes; |
50 final nl = nodes.length; | 50 final nl = nodes.length; |
51 | 51 |
52 for (int i = 0; i < num; i++) { | 52 for (int i = 0; i < num; i++) { |
53 for (int j = 0; j < nl; j++) { | 53 for (int j = 0; j < nl; j++) { |
54 Node cur = nodes[j]; | 54 Node cur = nodes[j]; |
55 while (cur !== null) { | 55 while (cur != null) { |
56 cur = cur.$dom_lastChild; | 56 cur = cur.$dom_lastChild; |
57 } | 57 } |
58 ret = cur; | 58 ret = cur; |
59 } | 59 } |
60 } | 60 } |
61 }) | 61 }) |
62 .test('nextSibling', () { | 62 .test('nextSibling', () { |
63 for (int i = 0; i < num * 2; i++) { | 63 for (int i = 0; i < num * 2; i++) { |
64 Node cur = document.body.$dom_firstChild; | 64 Node cur = document.body.$dom_firstChild; |
65 while (cur !== null) { | 65 while (cur != null) { |
66 cur = cur.nextNode; | 66 cur = cur.nextNode; |
67 } | 67 } |
68 ret = cur; | 68 ret = cur; |
69 } | 69 } |
70 }) | 70 }) |
71 .test('previousSibling', () { | 71 .test('previousSibling', () { |
72 for (int i = 0; i < num * 2; i++) { | 72 for (int i = 0; i < num * 2; i++) { |
73 Node cur = document.body.$dom_lastChild; | 73 Node cur = document.body.$dom_lastChild; |
74 while (cur !== null) { | 74 while (cur != null) { |
75 cur = cur.previousNode; | 75 cur = cur.previousNode; |
76 } | 76 } |
77 ret = cur; | 77 ret = cur; |
78 } | 78 } |
79 }) | 79 }) |
80 .test('childNodes', () { | 80 .test('childNodes', () { |
81 for (int i = 0; i < num; i++) { | 81 for (int i = 0; i < num; i++) { |
82 final nodes = document.body.$dom_childNodes; | 82 final nodes = document.body.$dom_childNodes; |
83 for (int j = 0; j < nodes.length; j++) { | 83 for (int j = 0; j < nodes.length; j++) { |
84 ret = nodes[j]; | 84 ret = nodes[j]; |
85 } | 85 } |
86 } | 86 } |
87 }) | 87 }) |
88 .end(); | 88 .end(); |
89 } | 89 } |
OLD | NEW |