| 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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 window.console.log("${stacktrace}"); | 562 window.console.log("${stacktrace}"); |
| 563 } | 563 } |
| 564 | 564 |
| 565 // Problem? | 565 // Problem? |
| 566 return null; | 566 return null; |
| 567 } | 567 } |
| 568 } | 568 } |
| 569 | 569 |
| 570 // Upgrade a Dart HtmlElement to the user's Dart custom element class. | 570 // Upgrade a Dart HtmlElement to the user's Dart custom element class. |
| 571 _upgradeHtmlElement(dartInstance) { | 571 _upgradeHtmlElement(dartInstance) { |
| 572 var dartInstanceMirror = reflect(dartInstance); | 572 // Only try upgrading HtmlElement (Dart class) if there is a failure then |
| 573 if (dartInstanceMirror.type.qualifiedName == #dart.dom.html.HtmlElement) { | 573 // don't try it again - one failure is enough. |
| 574 if (dartInstance.runtimeType == HtmlElement && !dartInstance.isBadUpgrade) { |
| 574 // Must be exactly HtmlElement not something derived from it. | 575 // Must be exactly HtmlElement not something derived from it. |
| 575 var jsObject = dartInstance.blink_jsObject; | 576 var jsObject = dartInstance.blink_jsObject; |
| 576 var localName = dartInstance.localName; | 577 var localName = dartInstance.localName; |
| 577 var customElementClass = _knownCustomeElements[localName]; | 578 var customElementClass = _knownCustomeElements[localName]; |
| 578 // Custom Element to upgrade. | 579 // Custom Element to upgrade. |
| 579 if (customElementClass != null) { | 580 if (customElementClass != null) { |
| 580 try { | 581 try { |
| 581 dartInstance = _blink.Blink_Utils.constructElement(customElementClass, j
sObject); | 582 dartInstance = _blink.Blink_Utils.constructElement(customElementClass, j
sObject); |
| 583 } catch (e) { |
| 584 dartInstance.badUpgrade(); |
| 582 } finally { | 585 } finally { |
| 583 dartInstance.blink_jsObject = jsObject; | 586 dartInstance.blink_jsObject = jsObject; |
| 584 jsObject['dart_class'] = dartInstance; | 587 jsObject['dart_class'] = dartInstance; |
| 585 js.setDartHtmlWrapperFor(jsObject, dartInstance); | 588 js.setDartHtmlWrapperFor(jsObject, dartInstance); |
| 586 } | 589 } |
| 587 } | 590 } |
| 588 } | 591 } |
| 589 | 592 |
| 590 return dartInstance; | 593 return dartInstance; |
| 591 } | 594 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 } | 674 } |
| 672 | 675 |
| 673 /** | 676 /** |
| 674 * Upgrade the JS HTMLElement to the Dart class. Used by Dart's Polymer. | 677 * Upgrade the JS HTMLElement to the Dart class. Used by Dart's Polymer. |
| 675 */ | 678 */ |
| 676 createCustomUpgrader(Type customElementClass, $this) { | 679 createCustomUpgrader(Type customElementClass, $this) { |
| 677 var dartClass; | 680 var dartClass; |
| 678 try { | 681 try { |
| 679 dartClass = _blink.Blink_Utils.constructElement(customElementClass, $this); | 682 dartClass = _blink.Blink_Utils.constructElement(customElementClass, $this); |
| 680 } catch (e) { | 683 } catch (e) { |
| 684 dartClass.badUpgrade(); |
| 681 throw e; | 685 throw e; |
| 682 } finally { | 686 } finally { |
| 683 // Need to remember the Dart class that was created for this custom so | 687 // Need to remember the Dart class that was created for this custom so |
| 684 // return it and setup the blink_jsObject to the $this that we'll be working | 688 // return it and setup the blink_jsObject to the $this that we'll be working |
| 685 // with as we talk to blink. | 689 // with as we talk to blink. |
| 686 js.setDartHtmlWrapperFor($this, dartClass); | 690 js.setDartHtmlWrapperFor($this, dartClass); |
| 687 } | 691 } |
| 688 | 692 |
| 689 return dartClass; | 693 return dartClass; |
| 690 } | 694 } |
| 691 | 695 |
| 692 $else | 696 $else |
| 693 class JsoNativeFieldWrapper extends NativeFieldWrapperClass2 {} | 697 class JsoNativeFieldWrapper extends NativeFieldWrapperClass2 {} |
| 694 | 698 |
| 695 unwrap_jso(dartClass_instance) => dartClass_instance; | 699 unwrap_jso(dartClass_instance) => dartClass_instance; |
| 696 wrap_jso(jsObject) => jsObject; | 700 wrap_jso(jsObject) => jsObject; |
| 697 make_dart_rectangle(r) => r; | 701 make_dart_rectangle(r) => r; |
| 698 convertDartToNative_Dictionary(Map dict) => dict; | 702 convertDartToNative_Dictionary(Map dict) => dict; |
| 699 List convertDartToNative_StringArray(List<String> input) => input; | 703 List convertDartToNative_StringArray(List<String> input) => input; |
| 700 convertDartToNative_List(List input) => input; | 704 convertDartToNative_List(List input) => input; |
| 701 createCustomUpgrader(Type customElementClass, $this) => $this; | 705 createCustomUpgrader(Type customElementClass, $this) => $this; |
| 702 | 706 |
| 703 $endif | 707 $endif |
| OLD | NEW |