2 * Copyright (C) 2006, 2007, 2009, 2015 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
23 JSGenerateToNativeObject,
24 ] interface Element : Node {
28 [TreatReturnedNullStringAs=Null] readonly attribute DOMString tagName;
30 [TreatReturnedNullStringAs=Null] DOMString getAttribute([Default=Undefined] optional DOMString name);
31 [ObjCLegacyUnnamedParameters, RaisesException] void setAttribute([Default=Undefined] optional DOMString name,
32 [Default=Undefined] optional DOMString value);
33 void removeAttribute([Default=Undefined] optional DOMString name);
34 Attr getAttributeNode([Default=Undefined] optional DOMString name);
35 [RaisesException] Attr setAttributeNode([Default=Undefined] optional Attr newAttr);
36 [RaisesException] Attr removeAttributeNode([Default=Undefined] optional Attr oldAttr);
38 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
39 [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName([Default=Undefined] optional DOMString name);
41 HTMLCollection getElementsByTagName([Default=Undefined] optional DOMString name);
44 #if !defined(LANGUAGE_OBJECTIVE_C)
45 // For ObjC this is defined on Node for legacy support.
46 readonly attribute NamedNodeMap attributes;
47 boolean hasAttributes();
52 [ObjCLegacyUnnamedParameters, TreatReturnedNullStringAs=Null] DOMString getAttributeNS([TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString namespaceURI,
53 [Default=Undefined] optional DOMString localName);
54 [ObjCLegacyUnnamedParameters, RaisesException] void setAttributeNS([TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString namespaceURI,
55 [Default=Undefined] optional DOMString qualifiedName,
56 [Default=Undefined] optional DOMString value);
57 [ObjCLegacyUnnamedParameters] void removeAttributeNS([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString namespaceURI,
60 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
61 [ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, [Default=Undefined] optional DOMString localName);
63 HTMLCollection getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, [Default=Undefined] optional DOMString localName);
65 [ObjCLegacyUnnamedParameters] Attr getAttributeNodeNS([TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString namespaceURI,
66 [Default=Undefined] optional DOMString localName);
67 [RaisesException] Attr setAttributeNodeNS([Default=Undefined] optional Attr newAttr);
68 boolean hasAttribute(DOMString name);
69 [ObjCLegacyUnnamedParameters] boolean hasAttributeNS([TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString namespaceURI,
70 [Default=Undefined] optional DOMString localName);
72 readonly attribute CSSStyleDeclaration style;
75 #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
76 [Reflect] attribute DOMString id;
81 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
82 readonly attribute long offsetLeft;
83 readonly attribute long offsetTop;
84 readonly attribute long offsetWidth;
85 readonly attribute long offsetHeight;
86 readonly attribute long clientLeft;
87 readonly attribute long clientTop;
88 readonly attribute long clientWidth;
89 readonly attribute long clientHeight;
91 readonly attribute double offsetLeft;
92 readonly attribute double offsetTop;
93 readonly attribute double offsetWidth;
94 readonly attribute double offsetHeight;
95 readonly attribute double clientLeft;
96 readonly attribute double clientTop;
97 readonly attribute double clientWidth;
98 readonly attribute double clientHeight;
101 attribute long scrollLeft;
102 attribute long scrollTop;
103 readonly attribute long scrollWidth;
104 readonly attribute long scrollHeight;
106 [ImplementedAs=bindingsOffsetParent] readonly attribute Element offsetParent;
110 void scrollIntoView(optional boolean alignWithTop);
114 void scrollIntoViewIfNeeded(optional boolean centerIfNeeded);
115 void scrollByLines([Default=Undefined] optional long lines);
116 void scrollByPages([Default=Undefined] optional long pages);
119 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
120 [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName([Default=Undefined] optional DOMString name);
122 HTMLCollection getElementsByClassName([Default=Undefined] optional DOMString name);
124 [TreatNullAs=NullString, SetterRaisesException] attribute DOMString innerHTML;
125 [TreatNullAs=NullString, SetterRaisesException] attribute DOMString outerHTML;
128 [Reflect=class] attribute DOMString className;
129 readonly attribute DOMTokenList classList;
131 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
132 readonly attribute DOMStringMap dataset;
135 [RaisesException] boolean matches(DOMString selectors);
136 [RaisesException] Element closest(DOMString selectors);
137 [ImplementedAs=matches, RaisesException] boolean webkitMatchesSelector(DOMString selectors);
139 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
140 // CSSOM View Module API
141 ClientRectList getClientRects();
142 ClientRect getBoundingClientRect();
145 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
146 // Objective-C extensions
147 readonly attribute DOMString innerText;
150 #if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
152 const unsigned short ALLOW_KEYBOARD_INPUT = 1;
153 void webkitRequestFullScreen([Default=Undefined] optional unsigned short flags);
156 void webkitRequestFullscreen();
159 #if defined(ENABLE_INDIE_UI) && ENABLE_INDIE_UI
160 [Reflect] attribute DOMString uiactions;
163 [Conditional=POINTER_LOCK] void requestPointerLock();
166 [Conditional=CSS_REGIONS] readonly attribute DOMString webkitRegionOverset;
167 [Conditional=CSS_REGIONS] sequence<Range> webkitGetRegionFlowRanges();
170 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
171 [Conditional=SHADOW_DOM, RaisesException] ShadowRoot attachShadow(Dictionary options);
172 [Conditional=SHADOW_DOM, ImplementedAs=shadowRootForBindings, CallWith=ScriptState] readonly attribute ShadowRoot shadowRoot;
173 [Conditional=SHADOW_DOM, Reflect] attribute DOMString slot;
178 // Unique to Element and Document
179 // FIXME: Should these be exposed on Window as well (and therefore moved to GlobalEventHandlers.idl)?
180 [NotEnumerable] attribute EventHandler onbeforecopy;
181 [NotEnumerable] attribute EventHandler onbeforecut;
182 [NotEnumerable] attribute EventHandler onbeforepaste;
183 [NotEnumerable] attribute EventHandler oncopy;
184 [NotEnumerable] attribute EventHandler oncut;
185 [NotEnumerable] attribute EventHandler onpaste;
186 [NotEnumerable] attribute EventHandler onselectstart;
187 [NotEnumerable, Conditional=FULLSCREEN_API] attribute EventHandler onwebkitfullscreenchange;
188 [NotEnumerable, Conditional=FULLSCREEN_API] attribute EventHandler onwebkitfullscreenerror;
190 // Unique to Element and DOMWindow
191 // FIXME: Should these be exposed on Document as well (and therefore moved to GlobalEventHandlers.idl)?
192 [NotEnumerable] attribute EventHandler onanimationend;
193 [NotEnumerable] attribute EventHandler onanimationiteration;
194 [NotEnumerable] attribute EventHandler onanimationstart;
195 [NotEnumerable] attribute EventHandler ontransitionend;
196 [NotEnumerable] attribute EventHandler onwebkitanimationend;
197 [NotEnumerable] attribute EventHandler onwebkitanimationiteration;
198 [NotEnumerable] attribute EventHandler onwebkitanimationstart;
199 [NotEnumerable] attribute EventHandler onwebkittransitionend;
200 [NotEnumerable, Conditional=IOS_GESTURE_EVENTS] attribute EventHandler ongesturechange;
201 [NotEnumerable, Conditional=IOS_GESTURE_EVENTS] attribute EventHandler ongestureend;
202 [NotEnumerable, Conditional=IOS_GESTURE_EVENTS] attribute EventHandler ongesturestart;
204 // Unique to Element, HTMLBodyElement and HTMLFrameSetElement
205 [NotEnumerable] attribute EventHandler onfocusin;
206 [NotEnumerable] attribute EventHandler onfocusout;
209 [NotEnumerable] attribute EventHandler onbeforeload;
210 [NotEnumerable, Conditional=ENCRYPTED_MEDIA] attribute EventHandler onwebkitkeyadded;
211 [NotEnumerable, Conditional=ENCRYPTED_MEDIA] attribute EventHandler onwebkitkeyerror;
212 [NotEnumerable, Conditional=ENCRYPTED_MEDIA] attribute EventHandler onwebkitkeymessage;
213 [NotEnumerable, Conditional=ENCRYPTED_MEDIA|ENCRYPTED_MEDIA_V2] attribute EventHandler onwebkitneedkey;
214 [NotEnumerable, Conditional=VIDEO_PRESENTATION_MODE] attribute EventHandler onwebkitpresentationmodechanged;
215 [NotEnumerable, Conditional=WIRELESS_PLAYBACK_TARGET] attribute EventHandler onwebkitcurrentplaybacktargetiswirelesschanged;
216 [NotEnumerable, Conditional=WIRELESS_PLAYBACK_TARGET] attribute EventHandler onwebkitplaybacktargetavailabilitychanged;
219 Element implements ChildNode;
220 Element implements ParentNode;
221 Element implements NonDocumentTypeChildNode;
222 Element implements GlobalEventHandlers;