| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 $(ANNOTATIONS)class $CLASSNAME$EXTENDS implements | 7 $(ANNOTATIONS)class $CLASSNAME$EXTENDS implements |
| 8 HiddenInputElement, | 8 HiddenInputElement, |
| 9 SearchInputElement, | 9 SearchInputElement, |
| 10 TextInputElement, | 10 TextInputElement, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 var e = document.$dom_createElement("input"); | 32 var e = document.$dom_createElement("input"); |
| 33 if (type != null) { | 33 if (type != null) { |
| 34 try { | 34 try { |
| 35 // IE throws an exception for unknown types. | 35 // IE throws an exception for unknown types. |
| 36 e.type = type; | 36 e.type = type; |
| 37 } catch(_) {} | 37 } catch(_) {} |
| 38 } | 38 } |
| 39 return e; | 39 return e; |
| 40 } | 40 } |
| 41 | 41 |
| 42 $if DART2JS | |
| 43 @Creates('Null') // Set from Dart code; does not instantiate a native type. | |
| 44 $endif | |
| 45 _ValueBinding _valueBinding; | |
| 46 | |
| 47 $if DART2JS | |
| 48 @Creates('Null') // Set from Dart code; does not instantiate a native type. | |
| 49 $endif | |
| 50 _CheckedBinding _checkedBinding; | |
| 51 | |
| 52 @Experimental | |
| 53 void bind(String name, model, String path) { | |
| 54 switch (name) { | |
| 55 case 'value': | |
| 56 unbind('value'); | |
| 57 attributes.remove('value'); | |
| 58 _valueBinding = new _ValueBinding(this, model, path); | |
| 59 break; | |
| 60 case 'checked': | |
| 61 unbind('checked'); | |
| 62 attributes.remove('checked'); | |
| 63 _checkedBinding = new _CheckedBinding(this, model, path); | |
| 64 break; | |
| 65 default: | |
| 66 // TODO(jmesserly): this should be "super" (http://dartbug.com/10166). | |
| 67 // Similar issue for unbind/unbindAll below. | |
| 68 Element._bindElement(this, name, model, path); | |
| 69 break; | |
| 70 } | |
| 71 } | |
| 72 | |
| 73 @Experimental | |
| 74 void unbind(String name) { | |
| 75 switch (name) { | |
| 76 case 'value': | |
| 77 if (_valueBinding != null) { | |
| 78 _valueBinding.unbind(); | |
| 79 _valueBinding = null; | |
| 80 } | |
| 81 break; | |
| 82 case 'checked': | |
| 83 if (_checkedBinding != null) { | |
| 84 _checkedBinding.unbind(); | |
| 85 _checkedBinding = null; | |
| 86 } | |
| 87 break; | |
| 88 default: | |
| 89 Element._unbindElement(this, name); | |
| 90 break; | |
| 91 } | |
| 92 } | |
| 93 | |
| 94 @Experimental | |
| 95 void unbindAll() { | |
| 96 unbind('value'); | |
| 97 unbind('checked'); | |
| 98 Element._unbindAllElement(this); | |
| 99 } | |
| 100 | |
| 101 $!MEMBERS | 42 $!MEMBERS |
| 102 } | 43 } |
| 103 | 44 |
| 104 | 45 |
| 105 // Interfaces representing the InputElement APIs which are supported | 46 // Interfaces representing the InputElement APIs which are supported |
| 106 // for the various types of InputElement. From: | 47 // for the various types of InputElement. From: |
| 107 // http://www.w3.org/html/wg/drafts/html/master/forms.html#the-input-element. | 48 // http://www.w3.org/html/wg/drafts/html/master/forms.html#the-input-element. |
| 108 | 49 |
| 109 /** | 50 /** |
| 110 * Exposes the functionality common between all InputElement types. | 51 * Exposes the functionality common between all InputElement types. |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 factory ResetButtonInputElement() => new InputElement(type: 'reset'); | 590 factory ResetButtonInputElement() => new InputElement(type: 'reset'); |
| 650 } | 591 } |
| 651 | 592 |
| 652 /** | 593 /** |
| 653 * A button, with no default behavior. | 594 * A button, with no default behavior. |
| 654 */ | 595 */ |
| 655 abstract class ButtonInputElement implements InputElementBase { | 596 abstract class ButtonInputElement implements InputElementBase { |
| 656 factory ButtonInputElement() => new InputElement(type: 'button'); | 597 factory ButtonInputElement() => new InputElement(type: 'button'); |
| 657 } | 598 } |
| 658 | 599 |
| OLD | NEW |