OLD | NEW |
1 library dom_traverse_html; | 1 library dom_traverse_html; |
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 void main() { | 8 void main() { |
9 final int num = 40; | 9 final int num = 40; |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 div.innerHTML = html; | 30 div.innerHTML = html; |
31 document.body.nodes.add(div); | 31 document.body.nodes.add(div); |
32 }) | 32 }) |
33 .test('firstChild', () { | 33 .test('firstChild', () { |
34 final nodes = document.body.nodes; | 34 final nodes = document.body.nodes; |
35 final nl = nodes.length; | 35 final nl = nodes.length; |
36 | 36 |
37 for (int i = 0; i < num; i++) { | 37 for (int i = 0; i < num; i++) { |
38 for (int j = 0; j < nl; j++) { | 38 for (int j = 0; j < nl; j++) { |
39 Node cur = nodes[j]; | 39 Node cur = nodes[j]; |
40 while (cur !== null) { | 40 while (cur != null) { |
41 cur = cur.nodes.first; | 41 cur = cur.nodes.first; |
42 } | 42 } |
43 ret = cur; | 43 ret = cur; |
44 } | 44 } |
45 } | 45 } |
46 }) | 46 }) |
47 .test('lastChild', () { | 47 .test('lastChild', () { |
48 final nodes = document.body.nodes; | 48 final nodes = document.body.nodes; |
49 final nl = nodes.length; | 49 final nl = nodes.length; |
50 | 50 |
51 for (int i = 0; i < num; i++) { | 51 for (int i = 0; i < num; i++) { |
52 for (int j = 0; j < nl; j++) { | 52 for (int j = 0; j < nl; j++) { |
53 Node cur = nodes[j]; | 53 Node cur = nodes[j]; |
54 while (cur !== null) { | 54 while (cur != null) { |
55 cur = cur.nodes.last; | 55 cur = cur.nodes.last; |
56 } | 56 } |
57 ret = cur; | 57 ret = cur; |
58 } | 58 } |
59 } | 59 } |
60 }) | 60 }) |
61 .test('nextSibling', () { | 61 .test('nextSibling', () { |
62 for (int i = 0; i < num * 2; i++) { | 62 for (int i = 0; i < num * 2; i++) { |
63 Node cur = document.body.nodes.first; | 63 Node cur = document.body.nodes.first; |
64 while (cur !== null) { | 64 while (cur != null) { |
65 cur = cur.nextNode; | 65 cur = cur.nextNode; |
66 } | 66 } |
67 ret = cur; | 67 ret = cur; |
68 } | 68 } |
69 }) | 69 }) |
70 .test('previousSibling', () { | 70 .test('previousSibling', () { |
71 for (int i = 0; i < num * 2; i++) { | 71 for (int i = 0; i < num * 2; i++) { |
72 Node cur = document.body.nodes.last; | 72 Node cur = document.body.nodes.last; |
73 while (cur !== null) { | 73 while (cur != null) { |
74 cur = cur.previousNode; | 74 cur = cur.previousNode; |
75 } | 75 } |
76 ret = cur; | 76 ret = cur; |
77 } | 77 } |
78 }) | 78 }) |
79 .test('childNodes', () { | 79 .test('childNodes', () { |
80 for (int i = 0; i < num; i++) { | 80 for (int i = 0; i < num; i++) { |
81 final nodes = document.body.nodes; | 81 final nodes = document.body.nodes; |
82 for (int j = 0; j < nodes.length; j++) { | 82 for (int j = 0; j < nodes.length; j++) { |
83 ret = nodes[j]; | 83 ret = nodes[j]; |
84 } | 84 } |
85 } | 85 } |
86 }) | 86 }) |
87 .end(); | 87 .end(); |
88 } | 88 } |
OLD | NEW |