| 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 dart.dom.html; | 5 part of dart.dom.html; |
| 6 | 6 |
| 7 void Function(T) _wrapZone<T>(void Function(T) callback) { | 7 // TODO(jacobr): remove these typedefs when dart:async supports generic types. |
| 8 typedef R _wrapZoneCallback<A, R>(A a); |
| 9 typedef R _wrapZoneBinaryCallback<A, B, R>(A a, B b); |
| 10 |
| 11 _wrapZoneCallback/*<A, R>*/ _wrapZone/*<A, R>*/( |
| 12 _wrapZoneCallback/*<A, R>*/ callback) { |
| 8 // For performance reasons avoid wrapping if we are in the root zone. | 13 // For performance reasons avoid wrapping if we are in the root zone. |
| 9 if (Zone.current == Zone.ROOT) return callback; | 14 if (Zone.current == Zone.ROOT) return callback; |
| 10 if (callback == null) return null; | 15 if (callback == null) return null; |
| 11 return Zone.current.bindUnaryCallbackGuarded(callback); | 16 return Zone.current.bindUnaryCallback/*<R, A>*/(callback, runGuarded: true); |
| 12 } | 17 } |
| 13 | 18 |
| 14 void Function(T1, T2) _wrapBinaryZone<T1, T2>(void Function(T1, T2) callback) { | 19 _wrapZoneBinaryCallback/*<A, B, R>*/ _wrapBinaryZone/*<A, B, R>*/( |
| 15 // For performance reasons avoid wrapping if we are in the root zone. | 20 _wrapZoneBinaryCallback/*<A, B, R>*/ callback) { |
| 16 if (Zone.current == Zone.ROOT) return callback; | 21 if (Zone.current == Zone.ROOT) return callback; |
| 17 if (callback == null) return null; | 22 if (callback == null) return null; |
| 18 return Zone.current.bindBinaryCallbackGuarded(callback); | 23 return Zone.current |
| 24 .bindBinaryCallback/*<R, A, B>*/(callback, runGuarded: true); |
| 19 } | 25 } |
| 20 | 26 |
| 21 /** | 27 /** |
| 22 * Alias for [querySelector]. Note this function is deprecated because its | 28 * Alias for [querySelector]. Note this function is deprecated because its |
| 23 * semantics will be changing in the future. | 29 * semantics will be changing in the future. |
| 24 */ | 30 */ |
| 25 @deprecated | 31 @deprecated |
| 26 @Experimental() | 32 @Experimental() |
| 27 Element query(String relativeSelectors) => document.query(relativeSelectors); | 33 Element query(String relativeSelectors) => document.query(relativeSelectors); |
| 28 /** | 34 /** |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 document.querySelectorAll(selectors); | 79 document.querySelectorAll(selectors); |
| 74 | 80 |
| 75 /// A utility for changing the Dart wrapper type for elements. | 81 /// A utility for changing the Dart wrapper type for elements. |
| 76 abstract class ElementUpgrader { | 82 abstract class ElementUpgrader { |
| 77 /// Upgrade the specified element to be of the Dart type this was created for. | 83 /// Upgrade the specified element to be of the Dart type this was created for. |
| 78 /// | 84 /// |
| 79 /// After upgrading the element passed in is invalid and the returned value | 85 /// After upgrading the element passed in is invalid and the returned value |
| 80 /// should be used instead. | 86 /// should be used instead. |
| 81 Element upgrade(Element element); | 87 Element upgrade(Element element); |
| 82 } | 88 } |
| OLD | NEW |