summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/Element.idl
blob: 4626e89254fdb455f0c129d5d42acfd418011fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*
 * Copyright (C) 2006, 2007, 2009, 2015 Apple Inc. All rights reserved.
 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

[
    CustomToJSObject,
    JSCustomHeader,
    JSGenerateToNativeObject,
    ExportMacro=WEBCORE_EXPORT,
] interface Element : Node {
    readonly attribute DOMString? tagName;

    [DOMJIT=ReadDOM] DOMString? getAttribute(DOMString name);

    [CEReactions, MayThrowException] void setAttribute(DOMString name, DOMString value);

    [CEReactions] void removeAttribute(DOMString name);
    [DOMJIT=ReadDOM] Attr? getAttributeNode(DOMString name);

    [CEReactions, MayThrowException] Attr? setAttributeNode(Attr newAttr);
    [CEReactions, MayThrowException] Attr removeAttributeNode(Attr oldAttr);

    [DOMJIT=ReadDOM] HTMLCollection getElementsByTagName(DOMString name);

    readonly attribute NamedNodeMap attributes;
    [DOMJIT=ReadDOM] boolean hasAttributes();

    DOMString? getAttributeNS(DOMString? namespaceURI, DOMString localName);

    [CEReactions, MayThrowException] void setAttributeNS(DOMString? namespaceURI, DOMString qualifiedName, DOMString value);
    [CEReactions] void removeAttributeNS(DOMString? namespaceURI, DOMString localName);

    HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);

    Attr? getAttributeNodeNS(DOMString? namespaceURI, DOMString localName);
    [CEReactions, MayThrowException] Attr? setAttributeNodeNS(Attr newAttr);
    boolean hasAttribute(DOMString name);

    boolean hasAttributeNS(DOMString? namespaceURI, DOMString localName);

    [ImplementedAs=cssomStyle] readonly attribute CSSStyleDeclaration style;

    [CEReactions, Reflect] attribute DOMString id;

    readonly attribute DOMString? namespaceURI;
    readonly attribute DOMString? prefix;
    readonly attribute DOMString localName;

    readonly attribute double offsetLeft;
    readonly attribute double offsetTop;
    readonly attribute double offsetWidth;
    readonly attribute double offsetHeight;
    readonly attribute double clientLeft;
    readonly attribute double clientTop;
    readonly attribute double clientWidth;
    readonly attribute double clientHeight;

    attribute long scrollLeft; // FIXME: should be unrestricted double
    attribute long scrollTop; // FIXME: should be unrestricted double
    readonly attribute long scrollWidth;
    readonly attribute long scrollHeight;

    [ImplementedAs=bindingsOffsetParent] readonly attribute Element offsetParent;

    void scrollIntoView(optional boolean alignWithTop = true);

    void scrollIntoViewIfNeeded(optional boolean centerIfNeeded = true);

    [ImplementedAs=scrollTo] void scroll(optional ScrollToOptions options);
    [ImplementedAs=scrollTo] void scroll(unrestricted double x, unrestricted double y);

    void scrollTo(optional ScrollToOptions options);
    void scrollTo(unrestricted double x, unrestricted double y);

    void scrollBy(optional ScrollToOptions option);
    void scrollBy(unrestricted double x, unrestricted double y);

    void scrollByLines(optional long lines = 0);
    void scrollByPages(optional long pages = 0);

    sequence<DOMString> getAttributeNames();

    HTMLCollection getElementsByClassName(DOMString name);
    [CEReactions, TreatNullAs=EmptyString, SetterMayThrowException] attribute DOMString innerHTML;
    [CEReactions, TreatNullAs=EmptyString, SetterMayThrowException] attribute DOMString outerHTML;

    [CEReactions, Reflect=class] attribute DOMString className;
    [PutForwards=value] readonly attribute DOMTokenList classList;

    [MayThrowException] boolean matches(DOMString selectors);
    [MayThrowException] Element? closest(DOMString selectors);
    [ImplementedAs=matches, MayThrowException] boolean webkitMatchesSelector(DOMString selectors);

    // CSSOM View Module API
    ClientRectList getClientRects();
    ClientRect getBoundingClientRect();

#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
    // Mozilla version
    [ImplementedAs=webkitRequestFullscreen] void webkitRequestFullScreen();

    // W3C version
    void webkitRequestFullscreen();
#endif

    [CEReactions, MayThrowException] Element? insertAdjacentElement(DOMString where, Element element);
    [CEReactions, MayThrowException] void insertAdjacentHTML(DOMString where, DOMString html);
    [MayThrowException] void insertAdjacentText(DOMString where, DOMString text);

    [Conditional=POINTER_LOCK] void requestPointerLock();

    // CSS Regions API
    [Conditional=CSS_REGIONS] readonly attribute DOMString webkitRegionOverset;
    [Conditional=CSS_REGIONS] sequence<Range> webkitGetRegionFlowRanges();

    // Shadow DOM API
    [EnabledAtRuntime=ShadowDOM, MayThrowException] ShadowRoot attachShadow(ShadowRootInit init);
    [EnabledAtRuntime=ShadowDOM, ImplementedAs=shadowRootForBindings, CallWith=ScriptState] readonly attribute ShadowRoot shadowRoot;
    [CEReactions, EnabledAtRuntime=ShadowDOM, Reflect] attribute DOMString slot;

    // Event Handlers

    // Unique to Element and Document
    // FIXME: Should these be exposed on Window as well (and therefore moved to GlobalEventHandlers.idl)?
    [NotEnumerable] attribute EventHandler onbeforecopy;
    [NotEnumerable] attribute EventHandler onbeforecut;
    [NotEnumerable] attribute EventHandler onbeforeinput;
    [NotEnumerable] attribute EventHandler onbeforepaste;
    [NotEnumerable] attribute EventHandler oncopy;
    [NotEnumerable] attribute EventHandler oncut;
    [NotEnumerable] attribute EventHandler onpaste;
    [NotEnumerable] attribute EventHandler onselectstart;
    [NotEnumerable, Conditional=FULLSCREEN_API] attribute EventHandler onwebkitfullscreenchange;
    [NotEnumerable, Conditional=FULLSCREEN_API] attribute EventHandler onwebkitfullscreenerror;

    // Unique to Element and DOMWindow
    // FIXME: Should these be exposed on Document as well (and therefore moved to GlobalEventHandlers.idl)?
    [NotEnumerable] attribute EventHandler onanimationend;
    [NotEnumerable] attribute EventHandler onanimationiteration;
    [NotEnumerable] attribute EventHandler onanimationstart;
    [NotEnumerable] attribute EventHandler ontransitionend;
    [NotEnumerable, ImplementedAs=onwebkitAnimationEnd] attribute EventHandler onwebkitanimationend;
    [NotEnumerable, ImplementedAs=onwebkitAnimationIteration] attribute EventHandler onwebkitanimationiteration;
    [NotEnumerable, ImplementedAs=onwebkitAnimationStart] attribute EventHandler onwebkitanimationstart;
    [NotEnumerable, ImplementedAs=onwebkitTransitionEnd] attribute EventHandler onwebkittransitionend;
    [NotEnumerable, Conditional=IOS_GESTURE_EVENTS] attribute EventHandler ongesturechange;
    [NotEnumerable, Conditional=IOS_GESTURE_EVENTS] attribute EventHandler ongestureend;
    [NotEnumerable, Conditional=IOS_GESTURE_EVENTS] attribute EventHandler ongesturestart;

    // Unique to Element, HTMLBodyElement and HTMLFrameSetElement
    [NotEnumerable] attribute EventHandler onfocusin;
    [NotEnumerable] attribute EventHandler onfocusout;

    // Unique to Element
    [NotEnumerable] attribute EventHandler onbeforeload;
    [NotEnumerable, Conditional=LEGACY_ENCRYPTED_MEDIA] attribute EventHandler onwebkitneedkey;
    [NotEnumerable, Conditional=VIDEO_PRESENTATION_MODE] attribute EventHandler onwebkitpresentationmodechanged;
    [NotEnumerable, Conditional=WIRELESS_PLAYBACK_TARGET] attribute EventHandler onwebkitcurrentplaybacktargetiswirelesschanged;
    [NotEnumerable, Conditional=WIRELESS_PLAYBACK_TARGET] attribute EventHandler onwebkitplaybacktargetavailabilitychanged;
};

dictionary ShadowRootInit {
    required ShadowRootMode mode;
};

Element implements Animatable;
Element implements ChildNode;
Element implements NonDocumentTypeChildNode;
Element implements ParentNode;
Element implements Slotable;