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 // DO NOT EDIT | 5 // DO NOT EDIT |
6 // Auto-generated dart:html library. | 6 // Auto-generated dart:html library. |
7 | 7 |
8 /** | 8 /** |
9 * HTML elements and other resources for web-based applications that need to | 9 * HTML elements and other resources for web-based applications that need to |
10 * interact with the browser and the DOM (Document Object Model). | 10 * interact with the browser and the DOM (Document Object Model). |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 */ | 442 */ |
443 wrap_jso(jsObject) { | 443 wrap_jso(jsObject) { |
444 try { | 444 try { |
445 if (jsObject is! js.JsObject || jsObject == null) { | 445 if (jsObject is! js.JsObject || jsObject == null) { |
446 // JS Interop converted the object to a Dart class e.g., Uint8ClampedList. | 446 // JS Interop converted the object to a Dart class e.g., Uint8ClampedList. |
447 // or it's a simple type. | 447 // or it's a simple type. |
448 return jsObject; | 448 return jsObject; |
449 } | 449 } |
450 | 450 |
451 var wrapper = js.getDartHtmlWrapperFor(jsObject); | 451 var wrapper = js.getDartHtmlWrapperFor(jsObject); |
452 // if we have a wrapper and and it's an upgraded custom element return the D
art instance. | 452 // if we have a wrapper return the Dart instance. |
453 if (wrapper != null) { | 453 if (wrapper != null) { |
454 if (wrapper.runtimeType == HtmlElement && !wrapper._isBadUpgrade) { | |
455 // We're a Dart instance but we need to upgrade. | |
456 var customElementClass = _getCustomElementType(wrapper); | |
457 if (customElementClass != null) { | |
458 var dartClass_instance; | |
459 try { | |
460 dartClass_instance = _blink.Blink_Utils.constructElement(customEleme
ntClass, jsObject); | |
461 } finally { | |
462 dartClass_instance.blink_jsObject = jsObject; | |
463 jsObject['dart_class'] = dartClass_instance; | |
464 js.setDartHtmlWrapperFor(jsObject, dartClass_instance); | |
465 return dartClass_instance; | |
466 } | |
467 } | |
468 } | |
469 | |
470 return wrapper; | 454 return wrapper; |
471 } | 455 } |
472 | 456 |
473 if (jsObject is js.JsArray) { | 457 if (jsObject is js.JsArray) { |
474 var wrappingList = new _DartHtmlWrappingList(jsObject); | 458 var wrappingList = new _DartHtmlWrappingList(jsObject); |
475 js.setDartHtmlWrapperFor(jsObject, wrappingList); | 459 js.setDartHtmlWrapperFor(jsObject, wrappingList); |
476 return wrappingList; | 460 return wrappingList; |
477 } | 461 } |
478 | 462 |
479 // Try the most general type conversions on it. | 463 // Try the most general type conversions on it. |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 | 772 |
789 unwrap_jso(dartClass_instance) => dartClass_instance; | 773 unwrap_jso(dartClass_instance) => dartClass_instance; |
790 wrap_jso(jsObject) => jsObject; | 774 wrap_jso(jsObject) => jsObject; |
791 make_dart_rectangle(r) => r; | 775 make_dart_rectangle(r) => r; |
792 convertDartToNative_Dictionary(Map dict) => dict; | 776 convertDartToNative_Dictionary(Map dict) => dict; |
793 List convertDartToNative_StringArray(List<String> input) => input; | 777 List convertDartToNative_StringArray(List<String> input) => input; |
794 convertDartToNative_List(List input) => input; | 778 convertDartToNative_List(List input) => input; |
795 createCustomUpgrader(Type customElementClass, $this) => $this; | 779 createCustomUpgrader(Type customElementClass, $this) => $this; |
796 | 780 |
797 $endif | 781 $endif |
OLD | NEW |