| 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 /// ** Internal Use Only ** | 398 /// ** Internal Use Only ** |
| 399 @Deprecated("Internal Use Only") | 399 @Deprecated("Internal Use Only") |
| 400 class DartHtmlDomObject { | 400 class DartHtmlDomObject { |
| 401 | 401 |
| 402 /// The underlying JS DOM object. | 402 /// The underlying JS DOM object. |
| 403 @Deprecated("Internal Use Only") | 403 @Deprecated("Internal Use Only") |
| 404 js.JsObject blink_jsObject; | 404 js.JsObject blink_jsObject; |
| 405 | 405 |
| 406 } | 406 } |
| 407 | 407 |
| 408 /// Upgrade a Dart HtmlElement to the user's Dart custom element class. | |
| 409 _upgradeHtmlElement(dartInstance) { | |
| 410 // Only try upgrading HtmlElement (Dart class) if there is a failure then | |
| 411 // don't try it again - one failure is enough. | |
| 412 if (dartInstance.runtimeType == HtmlElement && !dartInstance.isBadUpgrade) { | |
| 413 // Must be exactly HtmlElement not something derived from it. | |
| 414 | |
| 415 var customElementClass = getCustomElementType(dartInstance); | |
| 416 | |
| 417 // Custom Element to upgrade. | |
| 418 if (customElementClass != null) { | |
| 419 var jsObject = dartInstance.blink_jsObject; | |
| 420 try { | |
| 421 dartInstance = _blink.Blink_Utils.constructElement(customElementClass, j
sObject); | |
| 422 } catch (e) { | |
| 423 dartInstance._badUpgrade(); | |
| 424 } finally { | |
| 425 dartInstance.blink_jsObject = jsObject; | |
| 426 js.setDartHtmlWrapperFor(jsObject, dartInstance); | |
| 427 } | |
| 428 } | |
| 429 } | |
| 430 | |
| 431 return dartInstance; | |
| 432 } | |
| 433 | |
| 434 @Deprecated("Internal Use Only") | 408 @Deprecated("Internal Use Only") |
| 435 class DebugAssertException implements Exception { | 409 class DebugAssertException implements Exception { |
| 436 String message; | 410 String message; |
| 437 DebugAssertException(this.message); | 411 DebugAssertException(this.message); |
| 438 } | 412 } |
| 439 | 413 |
| 440 @Deprecated("Internal Use Only") | 414 @Deprecated("Internal Use Only") |
| 441 debug_or_assert(message, expression) { | 415 debug_or_assert(message, expression) { |
| 442 if (!expression) { | 416 if (!expression) { |
| 443 throw new DebugAssertException("$message"); | 417 throw new DebugAssertException("$message"); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 473 } | 447 } |
| 474 | 448 |
| 475 /** | 449 /** |
| 476 * Upgrade the JS HTMLElement to the Dart class. Used by Dart's Polymer. | 450 * Upgrade the JS HTMLElement to the Dart class. Used by Dart's Polymer. |
| 477 */ | 451 */ |
| 478 _createCustomUpgrader(Type customElementClass, $this) { | 452 _createCustomUpgrader(Type customElementClass, $this) { |
| 479 var dartClass; | 453 var dartClass; |
| 480 try { | 454 try { |
| 481 dartClass = _blink.Blink_Utils.constructElement(customElementClass, $this); | 455 dartClass = _blink.Blink_Utils.constructElement(customElementClass, $this); |
| 482 } catch (e) { | 456 } catch (e) { |
| 483 dartClass._badUpgrade(); | 457 // Did the dartClass get allocated but the created failed? Otherwise, other |
| 458 // components inside of this failed somewhere (could be JS custom element). |
| 459 if (dartClass != null) { |
| 460 // Yes, mark as didn't upgrade. |
| 461 dartClass._badUpgrade(); |
| 462 } |
| 484 throw e; | 463 throw e; |
| 485 } finally { | 464 } finally { |
| 486 // Need to remember the Dart class that was created for this custom so | 465 // Need to remember the Dart class that was created for this custom so |
| 487 // return it and setup the blink_jsObject to the $this that we'll be working | 466 // return it and setup the blink_jsObject to the $this that we'll be working |
| 488 // with as we talk to blink. | 467 // with as we talk to blink. |
| 489 js.setDartHtmlWrapperFor($this, dartClass); | 468 js.setDartHtmlWrapperFor($this, dartClass); |
| 490 } | 469 } |
| 491 | 470 |
| 492 return dartClass; | 471 return dartClass; |
| 493 } | 472 } |
| 494 | 473 |
| 495 $else | 474 $else |
| 496 class DartHtmlDomObject extends NativeFieldWrapperClass2 {} | 475 class DartHtmlDomObject extends NativeFieldWrapperClass2 {} |
| 497 | 476 |
| 498 _createCustomUpgrader(Type customElementClass, $this) => $this; | 477 _createCustomUpgrader(Type customElementClass, $this) => $this; |
| 499 | 478 |
| 500 $endif | 479 $endif |
| OLD | NEW |