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

Side by Side Diff: tools/dom/templates/html/impl/impl_Node.darttemplate

Issue 11887006: Changed @domName annotation in comment to full fledge @DomName annotation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 years, 11 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
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of html; 5 part of html;
6 6
7 /** 7 /**
8 * Lazy implementation of the child nodes of an element that does not request 8 * Lazy implementation of the child nodes of an element that does not request
9 * the actual child nodes of an element until strictly necessary greatly 9 * the actual child nodes of an element until strictly necessary greatly
10 * improving performance for the typical cases where it is not required. 10 * improving performance for the typical cases where it is not required.
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // a local copy of $dom_childNodes is more efficient. 195 // a local copy of $dom_childNodes is more efficient.
196 int get length => _this.$dom_childNodes.length; 196 int get length => _this.$dom_childNodes.length;
197 197
198 void set length(int value) { 198 void set length(int value) {
199 throw new UnsupportedError( 199 throw new UnsupportedError(
200 "Cannot set length on immutable List."); 200 "Cannot set length on immutable List.");
201 } 201 }
202 202
203 Node operator[](int index) => _this.$dom_childNodes[index]; 203 Node operator[](int index) => _this.$dom_childNodes[index];
204 } 204 }
205 205 $ANNOTATIONS
206 /// @domName $DOMNAME
207 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 206 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
208 List<Node> get nodes { 207 List<Node> get nodes {
209 return new _ChildNodeListLazy(this); 208 return new _ChildNodeListLazy(this);
210 } 209 }
211 210
212 void set nodes(Collection<Node> value) { 211 void set nodes(Collection<Node> value) {
213 // Copy list first since we don't want liveness during iteration. 212 // Copy list first since we don't want liveness during iteration.
214 // TODO(jacobr): there is a better way to do this. 213 // TODO(jacobr): there is a better way to do this.
215 List copy = new List.from(value); 214 List copy = new List.from(value);
216 text = ''; 215 text = '';
217 for (Node node in copy) { 216 for (Node node in copy) {
218 $dom_appendChild(node); 217 $dom_appendChild(node);
219 } 218 }
220 } 219 }
221 220
222 /** 221 /**
223 * Removes this node from the DOM. 222 * Removes this node from the DOM.
224 * @domName Node.removeChild
225 */ 223 */
224 @DomName('Node.removeChild')
226 void remove() { 225 void remove() {
227 // TODO(jacobr): should we throw an exception if parent is already null? 226 // TODO(jacobr): should we throw an exception if parent is already null?
228 // TODO(vsm): Use the native remove when available. 227 // TODO(vsm): Use the native remove when available.
229 if (this.parentNode != null) { 228 if (this.parentNode != null) {
230 final Node parent = this.parentNode; 229 final Node parent = this.parentNode;
231 parentNode.$dom_removeChild(this); 230 parentNode.$dom_removeChild(this);
232 } 231 }
233 } 232 }
234 233
235 /** 234 /**
236 * Replaces this node with another node. 235 * Replaces this node with another node.
237 * @domName Node.replaceChild
238 */ 236 */
237 @DomName('Node.replaceChild')
239 Node replaceWith(Node otherNode) { 238 Node replaceWith(Node otherNode) {
240 try { 239 try {
241 final Node parent = this.parentNode; 240 final Node parent = this.parentNode;
242 parent.$dom_replaceChild(otherNode, this); 241 parent.$dom_replaceChild(otherNode, this);
243 } catch (e) { 242 } catch (e) {
244 243
245 }; 244 };
246 return this; 245 return this;
247 } 246 }
248 247
249 $!MEMBERS 248 $!MEMBERS
250 } 249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698