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

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

Issue 17552019: Reorganize mdv and observe packages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged Created 7 years, 6 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 $LIBRARYNAME; 5 part of $LIBRARYNAME;
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 int get length => _this.$dom_childNodes.length; 171 int get length => _this.$dom_childNodes.length;
172 172
173 void set length(int value) { 173 void set length(int value) {
174 throw new UnsupportedError( 174 throw new UnsupportedError(
175 "Cannot set length on immutable List."); 175 "Cannot set length on immutable List.");
176 } 176 }
177 177
178 Node operator[](int index) => _this.$dom_childNodes[index]; 178 Node operator[](int index) => _this.$dom_childNodes[index];
179 } 179 }
180 180
181 /** Information about the instantiated template. */
182 class TemplateInstance {
183 // TODO(rafaelw): firstNode & lastNode should be read-synchronous
184 // in cases where script has modified the template instance boundary.
185
186 /** The first node of this template instantiation. */
187 final Node firstNode;
188
189 /**
190 * The last node of this template instantiation.
191 * This could be identical to [firstNode] if the template only expanded to a
192 * single node.
193 */
194 final Node lastNode;
195
196 /** The model used to instantiate the template. */
197 final model;
198
199 TemplateInstance(this.firstNode, this.lastNode, this.model);
200 }
201
181 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 202 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
182 List<Node> get nodes { 203 List<Node> get nodes {
183 return new _ChildNodeListLazy(this); 204 return new _ChildNodeListLazy(this);
184 } 205 }
185 206
186 void set nodes(Iterable<Node> value) { 207 void set nodes(Iterable<Node> value) {
187 // Copy list first since we don't want liveness during iteration. 208 // Copy list first since we don't want liveness during iteration.
188 // TODO(jacobr): there is a better way to do this. 209 // TODO(jacobr): there is a better way to do this.
189 List copy = new List.from(value); 210 List copy = new List.from(value);
190 text = ''; 211 text = '';
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 * Print out a String representation of this Node. 270 * Print out a String representation of this Node.
250 */ 271 */
251 String toString() => nodeValue == null ? super.toString() : nodeValue; 272 String toString() => nodeValue == null ? super.toString() : nodeValue;
252 273
253 /** 274 /**
254 * Binds the attribute [name] to the [path] of the [model]. 275 * Binds the attribute [name] to the [path] of the [model].
255 * Path is a String of accessors such as `foo.bar.baz`. 276 * Path is a String of accessors such as `foo.bar.baz`.
256 */ 277 */
257 @Experimental 278 @Experimental
258 void bind(String name, model, String path) { 279 void bind(String name, model, String path) {
259 // TODO(jmesserly): should we throw instead? 280 TemplateElement.mdvPackage(this).bind(name, model, path);
260 window.console.error('Unhandled binding to Node: '
261 '$this $name $model $path');
262 } 281 }
263 282
264 /** Unbinds the attribute [name]. */ 283 /** Unbinds the attribute [name]. */
265 @Experimental 284 @Experimental
266 void unbind(String name) {} 285 void unbind(String name) {
286 TemplateElement.mdvPackage(this).unbind(name);
287 }
267 288
268 /** Unbinds all bound attributes. */ 289 /** Unbinds all bound attributes. */
269 @Experimental 290 @Experimental
270 void unbindAll() {} 291 void unbindAll() {
271 292 TemplateElement.mdvPackage(this).unbindAll();
272 TemplateInstance _templateInstance; 293 }
273 294
274 /** Gets the template instance that instantiated this node, if any. */ 295 /** Gets the template instance that instantiated this node, if any. */
275 @Experimental 296 @Experimental
276 TemplateInstance get templateInstance => 297 TemplateInstance get templateInstance => mdvPackage(this).templateInstance;
277 _templateInstance != null ? _templateInstance :
278 (parent != null ? parent.templateInstance : null);
279 298
280 $!MEMBERS 299 $!MEMBERS
281 } 300 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698