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

Unified Diff: pkg/template_binding/lib/src/input_element.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 side-by-side diff with in-line comments
Download patch
Index: pkg/template_binding/lib/src/input_element.dart
diff --git a/pkg/template_binding/lib/src/input_element.dart b/pkg/template_binding/lib/src/input_element.dart
index 0a6d45a1a9569cb61eac3c5dfe6ef985a717edec..a599f24277a3a43cb19d4f3de1938a93e8d5b649 100644
--- a/pkg/template_binding/lib/src/input_element.dart
+++ b/pkg/template_binding/lib/src/input_element.dart
@@ -10,16 +10,15 @@ class _InputElementExtension extends _ElementExtension {
InputElement get _node => super._node;
- NodeBinding createBinding(String name, model, String path) {
- if (name == 'value') {
- // TODO(rafaelw): Maybe template should remove all binding instructions.
- _node.attributes.remove(name);
- return new _ValueBinding(_node, model, path);
+ NodeBinding bind(String name, model, [String path]) {
+ if (name != 'value' && name != 'checked') {
+ return super.bind(name, model, path);
}
- if (name == 'checked') {
- _node.attributes.remove(name);
- return new _CheckedBinding(_node, model, path);
- }
- return super.createBinding(name, model, path);
+
+ _self.unbind(name);
+ _node.attributes.remove(name);
+ return bindings[name] = name == 'value' ?
+ new _ValueBinding(_node, model, path) :
+ new _CheckedBinding(_node, model, path);
}
}

Powered by Google App Engine
This is Rietveld 408576698