OLD | NEW |
1 /** | 1 /** |
2 * HTML elements and other resources for web-based applications that need to | 2 * HTML elements and other resources for web-based applications that need to |
3 * interact with the browser and the DOM (Document Object Model). | 3 * interact with the browser and the DOM (Document Object Model). |
4 * | 4 * |
5 * This library includes DOM element types, CSS styling, local storage, | 5 * This library includes DOM element types, CSS styling, local storage, |
6 * media, speech, events, and more. | 6 * media, speech, events, and more. |
7 * To get started, | 7 * To get started, |
8 * check out the [Element] class, the base class for many of the HTML | 8 * check out the [Element] class, the base class for many of the HTML |
9 * DOM types. | 9 * DOM types. |
10 * | 10 * |
(...skipping 3934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3945 | 3945 |
3946 /** Sets the value of "zoom" */ | 3946 /** Sets the value of "zoom" */ |
3947 set zoom(String value) { | 3947 set zoom(String value) { |
3948 setProperty('zoom', value, ''); | 3948 setProperty('zoom', value, ''); |
3949 } | 3949 } |
3950 } | 3950 } |
3951 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3951 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
3952 // for details. All rights reserved. Use of this source code is governed by a | 3952 // for details. All rights reserved. Use of this source code is governed by a |
3953 // BSD-style license that can be found in the LICENSE file. | 3953 // BSD-style license that can be found in the LICENSE file. |
3954 | 3954 |
| 3955 // WARNING: Do not edit - generated code. |
| 3956 |
| 3957 |
| 3958 @DomName('CustomEvent') |
| 3959 @Native("CustomEvent") |
| 3960 class CustomEvent extends Event { |
| 3961 var _dartDetail; |
| 3962 |
| 3963 factory CustomEvent(String type, |
| 3964 {bool canBubble: true, bool cancelable: true, Object detail}) { |
| 3965 |
| 3966 final CustomEvent e = document._createEvent('CustomEvent'); |
| 3967 |
| 3968 e._dartDetail = detail; |
| 3969 |
| 3970 // Only try setting the detail if it's one of these types to avoid |
| 3971 // first-chance exceptions. Can expand this list in the future as needed. |
| 3972 if (detail is List || detail is Map || detail is String || detail is num) { |
| 3973 try { |
| 3974 e._initCustomEvent(type, canBubble, cancelable, detail); |
| 3975 } catch(_) { |
| 3976 e._initCustomEvent(type, canBubble, cancelable, null); |
| 3977 } |
| 3978 } else { |
| 3979 e._initCustomEvent(type, canBubble, cancelable, null); |
| 3980 } |
| 3981 |
| 3982 return e; |
| 3983 } |
| 3984 |
| 3985 @DomName('CustomEvent.detail') |
| 3986 get detail { |
| 3987 if (_dartDetail != null) { |
| 3988 return _dartDetail; |
| 3989 } |
| 3990 return _detail; |
| 3991 } |
| 3992 // To suppress missing implicit constructor warnings. |
| 3993 factory CustomEvent._() { throw new UnsupportedError("Not supported"); } |
| 3994 |
| 3995 |
| 3996 @Deprecated("Internal Use Only") |
| 3997 static CustomEvent internalCreateCustomEvent() { |
| 3998 return new CustomEvent.internal_(); |
| 3999 } |
| 4000 |
| 4001 @Deprecated("Internal Use Only") |
| 4002 CustomEvent.internal_() : super.internal_(); |
| 4003 |
| 4004 |
| 4005 @DomName('CustomEvent._detail') |
| 4006 @DocsEditable() |
| 4007 @Experimental() // untriaged |
| 4008 dynamic get _detail => convertNativeToDart_SerializedScriptValue(this._get__de
tail); |
| 4009 @JSName('detail') |
| 4010 @DomName('CustomEvent._detail') |
| 4011 @DocsEditable() |
| 4012 @Experimental() // untriaged |
| 4013 @Creates('Null') |
| 4014 dynamic get _get__detail => wrap_jso(JS("dynamic", "#.detail", this.raw)); |
| 4015 |
| 4016 @DomName('CustomEvent.initCustomEvent') |
| 4017 @DocsEditable() |
| 4018 void _initCustomEvent(String typeArg, bool canBubbleArg, bool cancelableArg, O
bject detailArg) { |
| 4019 _initCustomEvent_1(typeArg, canBubbleArg, cancelableArg, detailArg); |
| 4020 return; |
| 4021 } |
| 4022 @JSName('initCustomEvent') |
| 4023 @DomName('CustomEvent.initCustomEvent') |
| 4024 @DocsEditable() |
| 4025 void _initCustomEvent_1(typeArg, canBubbleArg, cancelableArg, detailArg) => wr
ap_jso(JS("void ", "#.raw.initCustomEvent(#, #, #, #)", this, unwrap_jso(typeArg
), unwrap_jso(canBubbleArg), unwrap_jso(cancelableArg), unwrap_jso(detailArg))); |
| 4026 |
| 4027 } |
| 4028 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4029 // for details. All rights reserved. Use of this source code is governed by a |
| 4030 // BSD-style license that can be found in the LICENSE file. |
| 4031 |
3955 | 4032 |
3956 @DocsEditable() | 4033 @DocsEditable() |
3957 /** | 4034 /** |
3958 * A generic container for content on an HTML page; | 4035 * A generic container for content on an HTML page; |
3959 * corresponds to the <div> tag. | 4036 * corresponds to the <div> tag. |
3960 * | 4037 * |
3961 * The [DivElement] is a generic container and does not have any semantic | 4038 * The [DivElement] is a generic container and does not have any semantic |
3962 * significance. It is functionally similar to [SpanElement]. | 4039 * significance. It is functionally similar to [SpanElement]. |
3963 * | 4040 * |
3964 * The [DivElement] is a block-level element, as opposed to [SpanElement], | 4041 * The [DivElement] is a block-level element, as opposed to [SpanElement], |
(...skipping 15594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19559 wrap_jso(jso) { | 19636 wrap_jso(jso) { |
19560 if (jso == null || jso is bool || jso is num || jso is String) { | 19637 if (jso == null || jso is bool || jso is num || jso is String) { |
19561 return jso; | 19638 return jso; |
19562 } | 19639 } |
19563 if (JS('bool', '#.hasOwnProperty(#)', jso, _wrapper)) { | 19640 if (JS('bool', '#.hasOwnProperty(#)', jso, _wrapper)) { |
19564 return JS('', '#[#]', jso, _wrapper); | 19641 return JS('', '#[#]', jso, _wrapper); |
19565 } | 19642 } |
19566 var constructor = JS('', '#.constructor', jso) | 19643 var constructor = JS('', '#.constructor', jso) |
19567 var f = null; | 19644 var f = null; |
19568 String name; | 19645 String name; |
19569 bool skip = false; | 19646 String skip = null; |
19570 while (f == null) { | 19647 while (f == null) { |
19571 name = JS('String', '#.name', constructor); | 19648 name = JS('String', '#.name', constructor); |
19572 f = getHtmlCreateFunction(name); | 19649 f = getHtmlCreateFunction(name); |
19573 if (f == null) { | 19650 if (f == null) { |
19574 console.error('Could not instantiate $name'); | 19651 if (skip == null) { |
19575 skip = true; | 19652 skip = name; |
| 19653 } |
19576 constructor = JS('', '#.__proto__', constructor); | 19654 constructor = JS('', '#.__proto__', constructor); |
19577 } | 19655 } |
19578 } | 19656 } |
19579 if (skip) { | 19657 if (skip != null) { |
19580 console.info('Instantiated $name instead'); | 19658 console.warn('Instantiated $name instead of $skip'); |
19581 } | 19659 } |
19582 var wrapped = f(); | 19660 var wrapped = f(); |
19583 wrapped.raw = jso; | 19661 wrapped.raw = jso; |
19584 JS('', '#[#] = #', jso, _wrapper, wrapped); | 19662 JS('', '#[#] = #', jso, _wrapper, wrapped); |
19585 return wrapped; | 19663 return wrapped; |
19586 } | 19664 } |
19587 | 19665 |
19588 createCustomUpgrader(Type customElementClass, $this) => $this; | 19666 createCustomUpgrader(Type customElementClass, $this) => $this; |
19589 | 19667 |
19590 // FIXME: Can we make this private? | 19668 // FIXME: Can we make this private? |
19591 final htmlBlinkMap = { | 19669 final htmlBlinkMap = { |
19592 '_HistoryCrossFrame': () => _HistoryCrossFrame, | 19670 '_HistoryCrossFrame': () => _HistoryCrossFrame, |
19593 '_LocationCrossFrame': () => _LocationCrossFrame, | 19671 '_LocationCrossFrame': () => _LocationCrossFrame, |
19594 '_DOMWindowCrossFrame': () => _DOMWindowCrossFrame, | 19672 '_DOMWindowCrossFrame': () => _DOMWindowCrossFrame, |
19595 // FIXME: Move these to better locations. | 19673 // FIXME: Move these to better locations. |
19596 'DateTime': () => DateTime, | 19674 'DateTime': () => DateTime, |
19597 'JsObject': () => js.JsObjectImpl, | 19675 'JsObject': () => js.JsObjectImpl, |
19598 'JsFunction': () => js.JsFunctionImpl, | 19676 'JsFunction': () => js.JsFunctionImpl, |
19599 'JsArray': () => js.JsArrayImpl, | 19677 'JsArray': () => js.JsArrayImpl, |
19600 'Attr': () => _Attr, | 19678 'Attr': () => _Attr, |
19601 'CSSStyleDeclaration': () => CssStyleDeclaration, | 19679 'CSSStyleDeclaration': () => CssStyleDeclaration, |
19602 'CharacterData': () => CharacterData, | 19680 'CharacterData': () => CharacterData, |
19603 'ChildNode': () => ChildNode, | 19681 'ChildNode': () => ChildNode, |
19604 'ClientRect': () => _ClientRect, | 19682 'ClientRect': () => _ClientRect, |
19605 'Comment': () => Comment, | 19683 'Comment': () => Comment, |
19606 'Console': () => Console, | 19684 'Console': () => Console, |
19607 'ConsoleBase': () => ConsoleBase, | 19685 'ConsoleBase': () => ConsoleBase, |
| 19686 'CustomEvent': () => CustomEvent, |
19608 'DOMImplementation': () => DomImplementation, | 19687 'DOMImplementation': () => DomImplementation, |
19609 'DOMTokenList': () => DomTokenList, | 19688 'DOMTokenList': () => DomTokenList, |
19610 'Document': () => Document, | 19689 'Document': () => Document, |
19611 'DocumentFragment': () => DocumentFragment, | 19690 'DocumentFragment': () => DocumentFragment, |
19612 'Element': () => Element, | 19691 'Element': () => Element, |
19613 'Event': () => Event, | 19692 'Event': () => Event, |
19614 'EventTarget': () => EventTarget, | 19693 'EventTarget': () => EventTarget, |
19615 'HTMLAnchorElement': () => AnchorElement, | 19694 'HTMLAnchorElement': () => AnchorElement, |
19616 'HTMLBaseElement': () => BaseElement, | 19695 'HTMLBaseElement': () => BaseElement, |
19617 'HTMLBodyElement': () => BodyElement, | 19696 'HTMLBodyElement': () => BodyElement, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19650 | 19729 |
19651 // FIXME: Can we make this private? | 19730 // FIXME: Can we make this private? |
19652 final htmlBlinkFunctionMap = { | 19731 final htmlBlinkFunctionMap = { |
19653 'Attr': () => _Attr.internalCreate_Attr, | 19732 'Attr': () => _Attr.internalCreate_Attr, |
19654 'CSSStyleDeclaration': () => CssStyleDeclaration.internalCreateCssStyleDeclara
tion, | 19733 'CSSStyleDeclaration': () => CssStyleDeclaration.internalCreateCssStyleDeclara
tion, |
19655 'CharacterData': () => CharacterData.internalCreateCharacterData, | 19734 'CharacterData': () => CharacterData.internalCreateCharacterData, |
19656 'ClientRect': () => _ClientRect.internalCreate_ClientRect, | 19735 'ClientRect': () => _ClientRect.internalCreate_ClientRect, |
19657 'Comment': () => Comment.internalCreateComment, | 19736 'Comment': () => Comment.internalCreateComment, |
19658 'Console': () => Console.internalCreateConsole, | 19737 'Console': () => Console.internalCreateConsole, |
19659 'ConsoleBase': () => ConsoleBase.internalCreateConsoleBase, | 19738 'ConsoleBase': () => ConsoleBase.internalCreateConsoleBase, |
| 19739 'CustomEvent': () => CustomEvent.internalCreateCustomEvent, |
19660 'DOMImplementation': () => DomImplementation.internalCreateDomImplementation, | 19740 'DOMImplementation': () => DomImplementation.internalCreateDomImplementation, |
19661 'DOMTokenList': () => DomTokenList.internalCreateDomTokenList, | 19741 'DOMTokenList': () => DomTokenList.internalCreateDomTokenList, |
19662 'Document': () => Document.internalCreateDocument, | 19742 'Document': () => Document.internalCreateDocument, |
19663 'DocumentFragment': () => DocumentFragment.internalCreateDocumentFragment, | 19743 'DocumentFragment': () => DocumentFragment.internalCreateDocumentFragment, |
19664 'Element': () => Element.internalCreateElement, | 19744 'Element': () => Element.internalCreateElement, |
19665 'Event': () => Event.internalCreateEvent, | 19745 'Event': () => Event.internalCreateEvent, |
19666 'EventTarget': () => EventTarget.internalCreateEventTarget, | 19746 'EventTarget': () => EventTarget.internalCreateEventTarget, |
19667 'HTMLAnchorElement': () => AnchorElement.internalCreateAnchorElement, | 19747 'HTMLAnchorElement': () => AnchorElement.internalCreateAnchorElement, |
19668 'HTMLBaseElement': () => BaseElement.internalCreateBaseElement, | 19748 'HTMLBaseElement': () => BaseElement.internalCreateBaseElement, |
19669 'HTMLBodyElement': () => BodyElement.internalCreateBodyElement, | 19749 'HTMLBodyElement': () => BodyElement.internalCreateBodyElement, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19712 return null; | 19792 return null; |
19713 } | 19793 } |
19714 | 19794 |
19715 Function _getHtmlFunction(String key) { | 19795 Function _getHtmlFunction(String key) { |
19716 if (htmlBlinkFunctionMap.containsKey(key)) { | 19796 if (htmlBlinkFunctionMap.containsKey(key)) { |
19717 return htmlBlinkFunctionMap[key](); | 19797 return htmlBlinkFunctionMap[key](); |
19718 } | 19798 } |
19719 return null; | 19799 return null; |
19720 } | 19800 } |
19721 | 19801 |
OLD | NEW |