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

Side by Side Diff: pkg/template_binding/lib/src/select_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, 1 month 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 part of template_binding; 5 part of template_binding;
6 6
7 /** Extensions to the [SelectElement] API. */ 7 /** Extensions to the [SelectElement] API. */
8 class _SelectElementExtension extends _ElementExtension { 8 class _SelectElementExtension extends _ElementExtension {
9 _SelectElementExtension(SelectElement node) : super(node); 9 _SelectElementExtension(SelectElement node) : super(node);
10 10
11 SelectElement get _node => super._node; 11 SelectElement get _node => super._node;
12 12
13 NodeBinding createBinding(String name, model, String path) { 13 NodeBinding bind(String name, model, [String path]) {
14 if (name.toLowerCase() == 'selectedindex') { 14 if (name == 'selectedindex') name = 'selectedIndex';
15 // TODO(rafaelw): Maybe template should remove all binding instructions. 15 if (name != 'selectedIndex' && name != 'value') {
16 _node.attributes.remove(name); 16 return super.bind(name, model, path);
17 return new _SelectedIndexBinding(_node, model, path);
18 } 17 }
19 return super.createBinding(name, model, path); 18
19 _self.unbind(name);
20 _node.attributes.remove(name);
21 return bindings[name] = new _SelectBinding(_node, name, model, path);
20 } 22 }
21 } 23 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698