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

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

Issue 34453003: Rename mdv -> template_binding, remove experiemntal apis from dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
« no previous file with comments | « tools/dom/templates/html/impl/impl_HTMLTemplateElement.darttemplate ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 int get length => _this.childNodes.length; 175 int get length => _this.childNodes.length;
176 176
177 void set length(int value) { 177 void set length(int value) {
178 throw new UnsupportedError( 178 throw new UnsupportedError(
179 "Cannot set length on immutable List."); 179 "Cannot set length on immutable List.");
180 } 180 }
181 181
182 Node operator[](int index) => _this.childNodes[index]; 182 Node operator[](int index) => _this.childNodes[index];
183 } 183 }
184 184
185 /** Information about the instantiated template. */
186 class TemplateInstance {
187 // TODO(rafaelw): firstNode & lastNode should be read-synchronous
188 // in cases where script has modified the template instance boundary.
189
190 /** The first node of this template instantiation. */
191 final Node firstNode;
192
193 /**
194 * The last node of this template instantiation.
195 * This could be identical to [firstNode] if the template only expanded to a
196 * single node.
197 */
198 final Node lastNode;
199
200 /** The model used to instantiate the template. */
201 final model;
202
203 TemplateInstance(this.firstNode, this.lastNode, this.model);
204 }
205
206 185
207 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 186 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
208 187
209 // Custom element created callback. 188 // Custom element created callback.
210 Node._created() : super._created(); 189 Node._created() : super._created();
211 190
212 List<Node> get nodes { 191 List<Node> get nodes {
213 return new _ChildNodeListLazy(this); 192 return new _ChildNodeListLazy(this);
214 } 193 }
215 194
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 this.insertBefore(node, refChild); 252 this.insertBefore(node, refChild);
274 } 253 }
275 } 254 }
276 } 255 }
277 256
278 /** 257 /**
279 * Print out a String representation of this Node. 258 * Print out a String representation of this Node.
280 */ 259 */
281 String toString() => nodeValue == null ? super.toString() : nodeValue; 260 String toString() => nodeValue == null ? super.toString() : nodeValue;
282 261
283
284 /**
285 * Creates a binding to the attribute [name] to the [path] of the [model].
286 *
287 * This can be overridden by custom elements to provide the binding used in
288 * [Node.bind]. This will only create the binding; it will not add it to
289 * [bindings].
290 *
291 * You should not need to call this directly except from [Node.bind].
292 */
293 @Experimental()
294 createBinding(String name, model, String path) =>
295 TemplateElement.mdvPackage(this).createBinding(name, model, path);
296
297 /**
298 * Binds the attribute [name] to the [path] of the [model].
299 * Path is a String of accessors such as `foo.bar.baz`.
300 * Returns the `NodeBinding` instance.
301 */
302 @Experimental()
303 bind(String name, model, String path) =>
304 TemplateElement.mdvPackage(this).bind(name, model, path);
305
306 /** Unbinds the attribute [name]. */
307 @Experimental()
308 void unbind(String name) {
309 TemplateElement.mdvPackage(this).unbind(name);
310 }
311
312 /** Unbinds all bound attributes. */
313 @Experimental()
314 void unbindAll() {
315 TemplateElement.mdvPackage(this).unbindAll();
316 }
317
318 /** Gets the data bindings that are associated with this node. */
319 @Experimental()
320 Map<String, dynamic> get bindings =>
321 TemplateElement.mdvPackage(this).bindings;
322
323 /** Gets the template instance that instantiated this node, if any. */
324 @Experimental()
325 TemplateInstance get templateInstance =>
326 TemplateElement.mdvPackage(this).templateInstance;
327
328
329 /** 262 /**
330 * Use ownerDocument instead. 263 * Use ownerDocument instead.
331 */ 264 */
332 @deprecated 265 @deprecated
333 Document get document => ownerDocument; 266 Document get document => ownerDocument;
334 267
335 $!MEMBERS 268 $!MEMBERS
336 } 269 }
OLDNEW
« no previous file with comments | « tools/dom/templates/html/impl/impl_HTMLTemplateElement.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698