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

Unified Diff: tools/dom/templates/html/impl/impl_Node.darttemplate

Issue 20149004: [mdv] implement Node.createBinding and Node.createBindings (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: tools/dom/templates/html/impl/impl_Node.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Node.darttemplate b/tools/dom/templates/html/impl/impl_Node.darttemplate
index 543cf1b8a04d9f662e496818278ad8744af8ef77..1eb46fa7d4d0089d998f86db7688521e574f7d44 100644
--- a/tools/dom/templates/html/impl/impl_Node.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Node.darttemplate
@@ -199,6 +199,7 @@ class TemplateInstance {
TemplateInstance(this.firstNode, this.lastNode, this.model);
}
+
$(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
List<Node> get nodes {
return new _ChildNodeListLazy(this);
@@ -271,14 +272,28 @@ $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
*/
String toString() => nodeValue == null ? super.toString() : nodeValue;
+
+ /**
+ * Creates a binding to the attribute [name] to the [path] of the [model].
+ *
+ * This can be overridden by custom elements to provide the binding used in
+ * [Node.bind]. This will only create the binding; it will not add it to
+ * [bindings].
+ *
+ * You should not need to call this directly except from [Node.bind].
+ */
+ @Experimental()
+ createBinding(String name, model, String path) =>
+ TemplateElement.mdvPackage(this).createBinding(name, model, path);
+
/**
* Binds the attribute [name] to the [path] of the [model].
* Path is a String of accessors such as `foo.bar.baz`.
+ * Returns the `NodeBinding` instance.
*/
@Experimental()
- void bind(String name, model, String path) {
- TemplateElement.mdvPackage(this).bind(name, model, path);
- }
+ bind(String name, model, String path) =>
+ TemplateElement.mdvPackage(this).bind(name, model, path);
/** Unbinds the attribute [name]. */
@Experimental()
@@ -292,6 +307,11 @@ $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
TemplateElement.mdvPackage(this).unbindAll();
}
+ /** Gets the data bindings that are associated with this node. */
+ @Experimental()
+ Map<String, dynamic> get bindings =>
+ TemplateElement.mdvPackage(this).bindings;
+
/** Gets the template instance that instantiated this node, if any. */
@Experimental()
TemplateInstance get templateInstance =>
« pkg/mdv/lib/src/template_iterator.dart ('K') | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698