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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

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:
Download patch
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index ca85edfa5d9bfb3e7960e00d300f999a5f80827f..06c82c8e2ebe1cb3b4fab07cc646eccc5c64e93f 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -16903,6 +16903,7 @@ class TemplateInstance {
TemplateInstance(this.firstNode, this.lastNode, this.model);
}
+
@DomName('Node')
class Node extends EventTarget native "Node" {
List<Node> get nodes {
@@ -16976,14 +16977,28 @@ class Node extends EventTarget native "Node" {
*/
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()
@@ -16997,6 +17012,11 @@ class Node extends EventTarget native "Node" {
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 =>

Powered by Google App Engine
This is Rietveld 408576698