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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 // Try the most general type conversions on it. | 408 // Try the most general type conversions on it. |
409 // TODO(alanknight): We may be able to do better. This maintains identity, | 409 // TODO(alanknight): We may be able to do better. This maintains identity, |
410 // which is useful, but expensive. And if we nest something that only | 410 // which is useful, but expensive. And if we nest something that only |
411 // this conversion handles, how does that work? e.g. a list of maps of eleme
nts. | 411 // this conversion handles, how does that work? e.g. a list of maps of eleme
nts. |
412 var converted = convertNativeToDart_SerializedScriptValue(jsObject); | 412 var converted = convertNativeToDart_SerializedScriptValue(jsObject); |
413 if (!identical(converted, jsObject)) { | 413 if (!identical(converted, jsObject)) { |
414 return converted; | 414 return converted; |
415 } | 415 } |
416 | 416 |
417 var constructor = js.JsNative.getProperty(jsObject, 'constructor'); | 417 var constructor = js.JsNative.getProperty(jsObject, 'constructor'); |
418 if (__interop_checks) { | 418 if (constructor == null) { |
419 debug_or_assert("constructor != null", constructor != null); | 419 // Perfectly valid case for JavaScript objects where __proto__ has |
| 420 // intentionally been set to null. |
| 421 js.setDartHtmlWrapperFor(jsObject, jsObject); |
| 422 return jsObject; |
420 } | 423 } |
421 var jsTypeName = js.JsNative.getProperty(constructor, 'name'); | 424 var jsTypeName = js.JsNative.getProperty(constructor, 'name'); |
422 if (__interop_checks) { | 425 if (jsTypeName is! String || jsTypeName.length == 0) { |
423 debug_or_assert("constructor != null && jsTypeName.length > 0", constructo
r != null && jsTypeName.length > 0); | 426 // Not an html type. |
| 427 js.setDartHtmlWrapperFor(jsObject, jsObject); |
| 428 return jsObject; |
424 } | 429 } |
425 | 430 |
426 var dartClass_instance; | 431 var dartClass_instance; |
427 if (jsObject.hasProperty('dart_class')) { | 432 if (jsObject.hasProperty('dart_class')) { |
428 // Got a dart_class (it's a custom element) use it it's already set up | 433 // Got a dart_class (it's a custom element) use it it's already set up |
429 // make sure it's upgraded. | 434 // make sure it's upgraded. |
430 dartClass_instance = _upgradeHtmlElement(jsObject['dart_class']); | 435 dartClass_instance = _upgradeHtmlElement(jsObject['dart_class']); |
431 } else { | 436 } else { |
432 var localName = jsObject['localName']; | 437 var localName = jsObject['localName']; |
433 var customElementClass = _knownCustomeElements[localName]; | 438 var customElementClass = _knownCustomeElements[localName]; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 return wrapper; | 488 return wrapper; |
484 } | 489 } |
485 | 490 |
486 if (jsObject is js.JsArray) { | 491 if (jsObject is js.JsArray) { |
487 var wrappingList = new _DartHtmlWrappingList(jsObject); | 492 var wrappingList = new _DartHtmlWrappingList(jsObject); |
488 js.setDartHtmlWrapperFor(jsObject, wrappingList); | 493 js.setDartHtmlWrapperFor(jsObject, wrappingList); |
489 return wrappingList; | 494 return wrappingList; |
490 } | 495 } |
491 | 496 |
492 var constructor = js.JsNative.getProperty(jsObject, 'constructor'); | 497 var constructor = js.JsNative.getProperty(jsObject, 'constructor'); |
493 if (__interop_checks) { | 498 if (constructor == null) { |
494 debug_or_assert("constructor != null", constructor != null); | 499 // Perfectly valid case for JavaScript objects where __proto__ has |
| 500 // intentionally been set to null. |
| 501 js.setDartHtmlWrapperFor(jsObject, jsObject); |
| 502 return jsObject; |
495 } | 503 } |
496 var jsTypeName = js.JsNative.getProperty(constructor, 'name'); | 504 var jsTypeName = js.JsNative.getProperty(constructor, 'name'); |
497 if (__interop_checks) { | 505 if (jsTypeName is! String || jsTypeName.length == 0) { |
498 debug_or_assert("constructor != null && jsTypeName.length > 0", constructo
r != null && jsTypeName.length > 0); | 506 // Not an html type. |
| 507 js.setDartHtmlWrapperFor(jsObject, jsObject); |
| 508 return jsObject; |
499 } | 509 } |
500 | 510 |
501 var func = getHtmlCreateFunction(jsTypeName); | 511 var func = getHtmlCreateFunction(jsTypeName); |
502 if (func != null) { | 512 if (func != null) { |
503 var dartClass_instance = func(); | 513 var dartClass_instance = func(); |
504 dartClass_instance.blink_jsObject = jsObject; | 514 dartClass_instance.blink_jsObject = jsObject; |
505 js.setDartHtmlWrapperFor(jsObject, dartClass_instance); | 515 js.setDartHtmlWrapperFor(jsObject, dartClass_instance); |
506 return dartClass_instance; | 516 return dartClass_instance; |
507 } | 517 } |
508 return jsObject; | 518 return jsObject; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 | 694 |
685 unwrap_jso(dartClass_instance) => dartClass_instance; | 695 unwrap_jso(dartClass_instance) => dartClass_instance; |
686 wrap_jso(jsObject) => jsObject; | 696 wrap_jso(jsObject) => jsObject; |
687 make_dart_rectangle(r) => r; | 697 make_dart_rectangle(r) => r; |
688 convertDartToNative_Dictionary(Map dict) => dict; | 698 convertDartToNative_Dictionary(Map dict) => dict; |
689 List convertDartToNative_StringArray(List<String> input) => input; | 699 List convertDartToNative_StringArray(List<String> input) => input; |
690 convertDartToNative_List(List input) => input; | 700 convertDartToNative_List(List input) => input; |
691 createCustomUpgrader(Type customElementClass, $this) => $this; | 701 createCustomUpgrader(Type customElementClass, $this) => $this; |
692 | 702 |
693 $endif | 703 $endif |
OLD | NEW |