OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | |
6 _NodeListImpl get nodes() { | |
7 final list = _childNodes; | |
8 list._parent = this; | |
9 return list; | |
10 } | |
11 | |
12 void set nodes(Collection<Node> value) { | |
13 // Copy list first since we don't want liveness during iteration. | |
14 // TODO(jacobr): there is a better way to do this. | |
15 List copy = new List.from(value); | |
16 text = ''; | |
17 for (Node node in copy) { | |
18 _appendChild(node); | |
19 } | |
20 } | |
21 | |
22 // TODO(jacobr): should we throw an exception if parent is already null? | |
23 _NodeImpl remove() { | |
24 if (this.parent != null) { | |
25 final _NodeImpl parent = this.parent; | |
26 parent._removeChild(this); | |
27 } | |
28 return this; | |
29 } | |
30 | |
31 _NodeImpl replaceWith(Node otherNode) { | |
32 try { | |
33 final _NodeImpl parent = this.parent; | |
34 parent._replaceChild(otherNode, this); | |
35 } catch(var e) { | |
36 | |
37 }; | |
38 return this; | |
39 } | |
40 | |
41 $!MEMBERS | |
42 } | |
OLD | NEW |