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

Side by Side Diff: pkg/mdv/lib/src/template.dart

Issue 19590007: [mdv] template.ref must recursive to find the original source template (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: revert file generated by dom.py Created 7 years, 5 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 mdv; 5 part of mdv;
6 6
7 /** Extensions to [Element]s that behave as templates. */ 7 /** Extensions to [Element]s that behave as templates. */
8 class _TemplateExtension extends _ElementExtension { 8 class _TemplateExtension extends _ElementExtension {
9 var _model; 9 var _model;
10 _TemplateIterator _templateIterator; 10 _TemplateIterator _templateIterator;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 /** 50 /**
51 * Creates an instance of the template. 51 * Creates an instance of the template.
52 */ 52 */
53 DocumentFragment createInstance(model, String syntax) { 53 DocumentFragment createInstance(model, String syntax) {
54 var template = node.ref; 54 var template = node.ref;
55 if (template == null) template = node; 55 if (template == null) template = node;
56 56
57 var instance = _createDeepCloneAndDecorateTemplates( 57 var instance = _createDeepCloneAndDecorateTemplates(
58 template.content, syntax); 58 template.ref.content, syntax);
59 59
60 if (_instanceCreated != null) _instanceCreated.add(instance); 60 if (_instanceCreated != null) _instanceCreated.add(instance);
61 61
62 _addBindings(instance, model, TemplateElement.syntax[syntax]); 62 _addBindings(instance, model, TemplateElement.syntax[syntax]);
63 _addTemplateInstanceRecord(instance, model); 63 _addTemplateInstanceRecord(instance, model);
64 return instance; 64 return instance;
65 } 65 }
66 66
67 /** 67 /**
68 * The data model which is inherited through the tree. 68 * The data model which is inherited through the tree.
69 */ 69 */
70 get model => _model; 70 get model => _model;
71 71
72 void set model(value) { 72 void set model(value) {
73 var syntax = TemplateElement.syntax[node.attributes['syntax']]; 73 var syntax = TemplateElement.syntax[node.attributes['syntax']];
74 _model = value; 74 _model = value;
75 _addBindings(node, model, syntax); 75 _addBindings(node, model, syntax);
76 } 76 }
77 } 77 }
OLDNEW
« no previous file with comments | « no previous file | pkg/mdv/test/template_element_test.dart » ('j') | pkg/mdv/test/template_element_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698