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

Side by Side Diff: pkg/mdv/lib/src/text_area_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, 4 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 part of mdv; 5 part of mdv;
6 6
7 /** Extensions to the [TextAreaElement] API. */ 7 /** Extensions to the [TextAreaElement] API. */
8 class _TextAreaElementExtension extends _ElementExtension { 8 class _TextAreaElementExtension extends _ElementExtension {
9 _ValueBinding _valueBinding;
10
11 _TextAreaElementExtension(TextAreaElement node) : super(node); 9 _TextAreaElementExtension(TextAreaElement node) : super(node);
12 10
13 TextAreaElement get node => super.node; 11 TextAreaElement get node => super.node;
14 12
15 void bind(String name, model, String path) { 13 NodeBinding createBinding(String name, model, String path) {
16 if (name.toLowerCase() == 'value') { 14 if (name == 'value') {
17 unbind('value'); 15 // TODO(rafaelw): Maybe template should remove all binding instructions.
18 node.attributes.remove('value'); 16 node.attributes.remove(name);
19 _valueBinding = new _ValueBinding(node, model, path); 17 return new _ValueBinding(node, model, path);
20 } 18 }
21 } 19 return super.createBinding(name, model, path);
22
23 void unbind(String name) {
24 if (name.toLowerCase() == 'value' && _valueBinding != null) {
25 _valueBinding.unbind();
26 _valueBinding = null;
27 }
28 }
29
30 void unbindAll() {
31 unbind('value');
32 super.unbindAll();
33 } 20 }
34 } 21 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698