| OLD | NEW |
| 1 Sky DOM APIs | 1 Sky DOM APIs |
| 2 ============ | 2 ============ |
| 3 | 3 |
| 4 ```dart | 4 ```dart |
| 5 SKY MODULE | 5 SKY MODULE |
| 6 <!-- part of dart:sky --> | 6 <!-- part of dart:sky --> |
| 7 | 7 |
| 8 <script> | 8 <script> |
| 9 // ELEMENT TREE API | 9 // ELEMENT TREE API |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 external Node get nextSibling; // O(1) | 34 external Node get nextSibling; // O(1) |
| 35 Element get nextElementSibling => { | 35 Element get nextElementSibling => { |
| 36 var result = nextSibling; | 36 var result = nextSibling; |
| 37 while (result != null && result is! Element) | 37 while (result != null && result is! Element) |
| 38 result = result.nextSibling; | 38 result = result.nextSibling; |
| 39 return result as Element; | 39 return result as Element; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // TODO(ianh): rename insertBefore() and insertAfter() since the Web |
| 43 // has an insertBefore() that means something else. What's a good |
| 44 // name, though? |
| 45 |
| 42 external void _insertBefore(Node node); // O(N) in number of descendants | 46 external void _insertBefore(Node node); // O(N) in number of descendants |
| 43 // node must be Text or Element, parentNode must be non-null | 47 // node must be Text or Element, parentNode must be non-null |
| 44 void insertBefore(List nodes) { | 48 void insertBefore(List nodes) { |
| 45 List.forEach((node) { | 49 List.forEach((node) { |
| 46 if (node is String) | 50 if (node is String) |
| 47 node = new Text(node); | 51 node = new Text(node); |
| 48 _insertBefore(node); | 52 _insertBefore(node); |
| 49 }); | 53 }); |
| 50 } | 54 } |
| 51 | 55 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 external bool matches(Element element); // O(F()) | 385 external bool matches(Element element); // O(F()) |
| 382 external Element find(Node root); // O(N*F())+O(M) where N is the number of de
scendants and M the average depth of the tree | 386 external Element find(Node root); // O(N*F())+O(M) where N is the number of de
scendants and M the average depth of the tree |
| 383 external List<Element> findAll(Node root); // O(N*F())+O(N*M) where N is the n
umber of descendants and M the average depth of the tree | 387 external List<Element> findAll(Node root); // O(N*F())+O(N*M) where N is the n
umber of descendants and M the average depth of the tree |
| 384 // find() and findAll() throw if the root is not one of the following: | 388 // find() and findAll() throw if the root is not one of the following: |
| 385 // - Element | 389 // - Element |
| 386 // - Fragment | 390 // - Fragment |
| 387 // - Root | 391 // - Root |
| 388 } | 392 } |
| 389 </script> | 393 </script> |
| 390 ``` | 394 ``` |
| OLD | NEW |