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

Side by Side Diff: pkg/mdv/lib/src/input_element.dart

Issue 17552019: Reorganize mdv and observe packages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/mdv/lib/src/element.dart ('k') | pkg/mdv/lib/src/node.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 part of mdv;
6
7 /** Extensions to the [InputElement] API. */
8 class _InputElementExtension extends _ElementExtension {
9 _InputElementExtension(InputElement node) : super(node);
10
11 InputElement get node => super.node;
12
13 _ValueBinding _valueBinding;
14
15 _CheckedBinding _checkedBinding;
16
17 void bind(String name, model, String path) {
18 switch (name) {
19 case 'value':
20 unbind('value');
21 node.attributes.remove('value');
22 _valueBinding = new _ValueBinding(node, model, path);
23 break;
24 case 'checked':
25 unbind('checked');
26 node.attributes.remove('checked');
27 _checkedBinding = new _CheckedBinding(node, model, path);
28 break;
29 default:
30 super.bind(name, model, path);
31 break;
32 }
33 }
34
35 void unbind(String name) {
36 switch (name) {
37 case 'value':
38 if (_valueBinding != null) {
39 _valueBinding.unbind();
40 _valueBinding = null;
41 }
42 break;
43 case 'checked':
44 if (_checkedBinding != null) {
45 _checkedBinding.unbind();
46 _checkedBinding = null;
47 }
48 break;
49 default:
50 super.unbind(name);
51 break;
52 }
53 }
54
55 void unbindAll() {
56 unbind('value');
57 unbind('checked');
58 super.unbindAll();
59 }
60 }
OLDNEW
« no previous file with comments | « pkg/mdv/lib/src/element.dart ('k') | pkg/mdv/lib/src/node.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698