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

Unified Diff: pkg/mdv/lib/src/select_element.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:
View side-by-side diff with in-line comments
Download patch
Index: pkg/mdv/lib/src/select_element.dart
diff --git a/pkg/mdv/lib/src/select_element.dart b/pkg/mdv/lib/src/select_element.dart
index 64b599aa142c5027a18977ef64cae4207aa2440b..05b186eccd878f64db239faeeab4e3c695c01900 100644
--- a/pkg/mdv/lib/src/select_element.dart
+++ b/pkg/mdv/lib/src/select_element.dart
@@ -6,33 +6,16 @@ part of mdv;
/** Extensions to the [SelectElement] API. */
class _SelectElementExtension extends _ElementExtension {
- _SelectedIndexBinding _valueBinding;
-
_SelectElementExtension(SelectElement node) : super(node);
SelectElement get node => super.node;
- void bind(String name, model, String path) {
- if (name.toLowerCase() == 'selectedindex') {
- unbind('selectedindex');
- node.attributes.remove('selectedindex');
- _valueBinding = new _SelectedIndexBinding(node, model, path);
- return;
- }
- super.bind(name, model, path);
- }
-
- void unbind(String name) {
- if (name.toLowerCase() == 'selectedindex' && _valueBinding != null) {
- _valueBinding.unbind();
- _valueBinding = null;
- return;
+ NodeBinding createBinding(String name, model, String path) {
+ if (name.toLowerCase() === 'selectedindex') {
+ // TODO(rafaelw): Maybe template should remove all binding instructions.
+ node.attributes.remove(name);
+ return new _SelectedIndexBinding(node, model, path);
}
- super.unbind(name);
- }
-
- void unbindAll() {
- unbind('selectedindex');
- super.unbindAll();
+ return super.createBinding(name, model, path);
}
}

Powered by Google App Engine
This is Rietveld 408576698