| OLD | NEW |
| 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 abstract class _InputBinding extends NodeBinding { | 7 abstract class _InputBinding extends NodeBinding { |
| 8 StreamSubscription _eventSub; | 8 StreamSubscription _eventSub; |
| 9 | 9 |
| 10 _InputBinding(node, name, model, path): super(node, name, model, path) { | 10 _InputBinding(node, name, model, path): super(node, name, model, path) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 static Iterable _getAssociatedRadioButtons(element) { | 107 static Iterable _getAssociatedRadioButtons(element) { |
| 108 if (!_isNodeInDocument(element)) return []; | 108 if (!_isNodeInDocument(element)) return []; |
| 109 if (element.form != null) { | 109 if (element.form != null) { |
| 110 return element.form.nodes.where((el) { | 110 return element.form.nodes.where((el) { |
| 111 return el != element && | 111 return el != element && |
| 112 el is InputElement && | 112 el is InputElement && |
| 113 el.type == 'radio' && | 113 el.type == 'radio' && |
| 114 el.name == element.name; | 114 el.name == element.name; |
| 115 }); | 115 }); |
| 116 } else { | 116 } else { |
| 117 var radios = element.document.queryAll( | 117 var radios = element.ownerDocument.queryAll( |
| 118 'input[type="radio"][name="${element.name}"]'); | 118 'input[type="radio"][name="${element.name}"]'); |
| 119 return radios.where((el) => el != element && el.form == null); | 119 return radios.where((el) => el != element && el.form == null); |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 // TODO(jmesserly): polyfill document.contains API instead of doing it here | 123 // TODO(jmesserly): polyfill document.contains API instead of doing it here |
| 124 static bool _isNodeInDocument(Node node) { | 124 static bool _isNodeInDocument(Node node) { |
| 125 // On non-IE this works: | 125 // On non-IE this works: |
| 126 // return node.ownerDocument.contains(node); | 126 // return node.ownerDocument.contains(node); |
| 127 var document = node.document; | 127 var document = node.document; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 // TODO(jmesserly,sigmund): I wonder how many bindings typically convert from | 178 // TODO(jmesserly,sigmund): I wonder how many bindings typically convert from |
| 179 // one type to another (e.g. value-as-number) and whether it is useful to | 179 // one type to another (e.g. value-as-number) and whether it is useful to |
| 180 // have something like a int/num binding converter (either as a base class or | 180 // have something like a int/num binding converter (either as a base class or |
| 181 // a wrapper). | 181 // a wrapper). |
| 182 static int _toInt(value) { | 182 static int _toInt(value) { |
| 183 if (value is String) return int.parse(value, onError: (_) => null); | 183 if (value is String) return int.parse(value, onError: (_) => null); |
| 184 return value is int ? value : null; | 184 return value is int ? value : null; |
| 185 } | 185 } |
| 186 } | 186 } |
| OLD | NEW |