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

Side by Side Diff: pkg/template_binding/lib/template_binding.dart

Issue 42433002: port Node.bind to bd0a0591920da9091b326627a46a104a92c7efe7 (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
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 /** 5 /**
6 * This library provides access to the Polymer project's 6 * This library provides access to the Polymer project's
7 * [Data Binding](http://www.polymer-project.org/docs/polymer/databinding.html) 7 * [Data Binding](http://www.polymer-project.org/docs/polymer/databinding.html)
8 * Find more information at the 8 * Find more information at the
9 * [Polymer.dart homepage](https://www.dartlang.org/polymer-dart/). 9 * [Polymer.dart homepage](https://www.dartlang.org/polymer-dart/).
10 * 10 *
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 * // otherwise, fall back to superclass 97 * // otherwise, fall back to superclass
98 * return nodeBindFallback(this).bind(name, model, path); 98 * return nodeBindFallback(this).bind(name, model, path);
99 * } 99 * }
100 * ... 100 * ...
101 * } 101 * }
102 */ 102 */
103 NodeBindExtension nodeBindFallback(Node node) { 103 NodeBindExtension nodeBindFallback(Node node) {
104 var extension = _expando[node]; 104 var extension = _expando[node];
105 if (extension != null) return extension; 105 if (extension != null) return extension;
106 106
107 // TODO(jmesserly): switch on localName?
107 if (node is InputElement) { 108 if (node is InputElement) {
108 extension = new _InputElementExtension(node); 109 extension = new _InputElementExtension(node);
109 } else if (node is SelectElement) { 110 } else if (node is SelectElement) {
110 extension = new _SelectElementExtension(node); 111 extension = new _SelectElementExtension(node);
111 } else if (node is TextAreaElement) { 112 } else if (node is TextAreaElement) {
112 extension = new _TextAreaElementExtension(node); 113 extension = new _TextAreaElementExtension(node);
113 } else if (node is Element) { 114 } else if (node is Element) {
114 if (isSemanticTemplate(node)) { 115 if (isSemanticTemplate(node)) {
115 extension = new TemplateBindExtension._(node); 116 extension = new TemplateBindExtension._(node);
116 } else { 117 } else {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 163
163 // The expando for storing our MDV extensions. 164 // The expando for storing our MDV extensions.
164 // 165 //
165 // In general, we need state associated with the nodes. Rather than having a 166 // In general, we need state associated with the nodes. Rather than having a
166 // bunch of individual expandos, we keep one per node. 167 // bunch of individual expandos, we keep one per node.
167 // 168 //
168 // Aside from the potentially helping performance, it also keeps things simpler 169 // Aside from the potentially helping performance, it also keeps things simpler
169 // if we decide to integrate MDV into the DOM later, and means less code needs 170 // if we decide to integrate MDV into the DOM later, and means less code needs
170 // to worry about expandos. 171 // to worry about expandos.
171 final Expando _expando = new Expando('template_binding'); 172 final Expando _expando = new Expando('template_binding');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698