/* * Copyright (C) 2006, 2007, 2009, 2015 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig * * 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 { // DOM Level 1 Core readonly attribute DOMString? tagName; // FIXME: Using "undefined" as default parameter value is wrong. DOMString? getAttribute(optional DOMString name = "undefined"); [ObjCLegacyUnnamedParameters, RaisesException, InvokesCustomElementLifecycleCallbacks] // FIXME: Using "undefined" as default parameter value is wrong. void setAttribute(optional DOMString name = "undefined", optional DOMString value = "undefined"); // FIXME: Using "undefined" as default parameter value is wrong. [InvokesCustomElementLifecycleCallbacks] void removeAttribute(optional DOMString name = "undefined"); Attr getAttributeNode(optional DOMString name = "undefined"); [RaisesException, InvokesCustomElementLifecycleCallbacks] Attr setAttributeNode(Attr newAttr); [RaisesException, InvokesCustomElementLifecycleCallbacks] Attr removeAttributeNode(Attr oldAttr); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName(optional DOMString name); #else // FIXME: Using "undefined" as default parameter value is wrong. HTMLCollection getElementsByTagName(optional DOMString name = "undefined"); #endif #if !defined(LANGUAGE_OBJECTIVE_C) // For ObjC this is defined on Node for legacy support. readonly attribute NamedNodeMap attributes; boolean hasAttributes(); #endif // DOM Level 2 Core // FIXME: Using "undefined" as default parameter value is wrong. [ObjCLegacyUnnamedParameters] DOMString? getAttributeNS(optional DOMString? namespaceURI = null, optional DOMString localName = "undefined"); [ObjCLegacyUnnamedParameters, RaisesException, InvokesCustomElementLifecycleCallbacks] // FIXME: Using "undefined" as default parameter value is wrong. void setAttributeNS(optional DOMString? namespaceURI = null, optional DOMString qualifiedName = "undefined", optional DOMString value = "undefined"); [ObjCLegacyUnnamedParameters, InvokesCustomElementLifecycleCallbacks] void removeAttributeNS(DOMString? namespaceURI, DOMString localName); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C [ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS(optional DOMString namespaceURI, optional DOMString localName); #else // FIXME: Using "undefined" as default parameter value is wrong. HTMLCollection getElementsByTagNameNS(optional DOMString? namespaceURI = null, optional DOMString localName = "undefined"); #endif // FIXME: Using "undefined" as default parameter value is wrong. [ObjCLegacyUnnamedParameters] Attr getAttributeNodeNS(optional DOMString? namespaceURI = null, optional DOMString localName = "undefined"); [RaisesException, InvokesCustomElementLifecycleCallbacks] Attr setAttributeNodeNS(Attr newAttr); boolean hasAttribute(DOMString name); // FIXME: Using "undefined" as default parameter value is wrong. [ObjCLegacyUnnamedParameters] boolean hasAttributeNS(optional DOMString? namespaceURI = null, optional DOMString localName = "undefined"); [ImplementedAs=cssomStyle] readonly attribute CSSStyleDeclaration style; // DOM 4 #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C [Reflect] attribute DOMString id; #endif // Common extensions #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C readonly attribute long offsetLeft; readonly attribute long offsetTop; readonly attribute long offsetWidth; readonly attribute long offsetHeight; readonly attribute long clientLeft; readonly attribute long clientTop; readonly attribute long clientWidth; readonly attribute long clientHeight; #else 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; #endif attribute long scrollLeft; attribute long scrollTop; readonly attribute long scrollWidth; readonly attribute long scrollHeight; [ImplementedAs=bindingsOffsetParent] readonly attribute Element offsetParent; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT void focus(); void blur(); #endif void scrollIntoView(optional boolean alignWithTop = true); // WebKit extensions void scrollIntoViewIfNeeded(optional boolean centerIfNeeded = true); void scrollByLines(optional long lines = 0); void scrollByPages(optional long pages = 0); // HTML 5 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName(optional DOMString name); #else // FIXME: Using "undefined" as default parameter value is wrong. HTMLCollection getElementsByClassName(optional DOMString name = "undefined"); #endif [TreatNullAs=EmptyString, SetterRaisesException] attribute DOMString innerHTML; [TreatNullAs=EmptyString, SetterRaisesException] attribute DOMString outerHTML; [Reflect=class] attribute DOMString className; [PutForwards=value] readonly attribute DOMTokenList classList; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT readonly attribute DOMStringMap dataset; #endif [RaisesException] boolean matches(DOMString selectors); [RaisesException] Element closest(DOMString selectors); [ImplementedAs=matches, RaisesException] boolean webkitMatchesSelector(DOMString selectors); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // CSSOM View Module API ClientRectList getClientRects(); ClientRect getBoundingClientRect(); #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C // Objective-C extensions readonly attribute DOMString innerText; #endif #if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API // Mozilla version const unsigned short ALLOW_KEYBOARD_INPUT = 1; void webkitRequestFullScreen(optional unsigned short flags = 0); // W3C version void webkitRequestFullscreen(); #endif #if defined(ENABLE_INDIE_UI) && ENABLE_INDIE_UI [Reflect] attribute DOMString uiactions; #endif [Conditional=POINTER_LOCK] void requestPointerLock(); // CSS Regions API [Conditional=CSS_REGIONS] readonly attribute DOMString webkitRegionOverset; [Conditional=CSS_REGIONS] sequence webkitGetRegionFlowRanges(); // Shadow DOM API #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT [EnabledAtRuntime=ShadowDOM, RaisesException] ShadowRoot attachShadow(ShadowRootInit init); [EnabledAtRuntime=ShadowDOM, ImplementedAs=shadowRootForBindings, CallWith=ScriptState] readonly attribute ShadowRoot shadowRoot; [EnabledAtRuntime=ShadowDOM, Reflect] attribute DOMString slot; #endif // 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 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=ENCRYPTED_MEDIA] attribute EventHandler onwebkitkeyadded; [NotEnumerable, Conditional=ENCRYPTED_MEDIA] attribute EventHandler onwebkitkeyerror; [NotEnumerable, Conditional=ENCRYPTED_MEDIA] attribute EventHandler onwebkitkeymessage; [NotEnumerable, Conditional=ENCRYPTED_MEDIA|ENCRYPTED_MEDIA_V2] 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; }; enum ShadowRootMode { "open", "closed" }; dictionary ShadowRootInit { required ShadowRootMode mode; }; Element implements ChildNode; Element implements ParentNode; Element implements NonDocumentTypeChildNode; Element implements GlobalEventHandlers;