blob: 8d45e7d091190b9db985bb3e510830088782610f [file] [log] [blame]
/*
* Copyright (C) 2006, 2007, 2009 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.
*/
[
SpecialWrapFor=HTMLElement|SVGElement
] interface Element : Node {
// DOM Level 1 Core
[TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString tagName;
[TreatReturnedNullStringAs=Null] DOMString getAttribute([Default=Undefined] optional DOMString name);
[RaisesException, CustomElementCallbacks] void setAttribute([Default=Undefined] optional DOMString name, [Default=Undefined] optional DOMString value);
[CustomElementCallbacks] void removeAttribute([Default=Undefined] optional DOMString name);
[MeasureAs=ElementGetAttributeNode] Attr getAttributeNode([Default=Undefined] optional DOMString name); // Removed from DOM4.
[RaisesException, CustomElementCallbacks, MeasureAs=ElementSetAttributeNode] Attr setAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr newAttr); // Removed from DOM4.
[RaisesException, CustomElementCallbacks, MeasureAs=ElementRemoveAttributeNode] Attr removeAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr oldAttr); // Removed from DOM4.
[PerWorldBindings] NodeList getElementsByTagName([Default=Undefined] optional DOMString name);
[PerWorldBindings] readonly attribute NamedNodeMap attributes;
[MeasureAs=HasAttributes] boolean hasAttributes();
// DOM Level 2 Core
DOMString getAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString localName);
[RaisesException, CustomElementCallbacks] void setAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString qualifiedName,
[Default=Undefined] optional DOMString value);
[CustomElementCallbacks] void removeAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName);
NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString localName);
[MeasureAs=ElementGetAttributeNodeNS] Attr getAttributeNodeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString localName); // Removed from DOM4.
[RaisesException, CustomElementCallbacks] Attr setAttributeNodeNS([Default=Undefined, StrictTypeChecking] optional Attr newAttr);
boolean hasAttribute(DOMString name);
boolean hasAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString localName);
[PerWorldBindings] readonly attribute CSSStyleDeclaration style;
// DOM4
// iht.com relies on id returning the empty string when no id is present.
// Other browsers do this as well. So we don't convert null to JS null.
[Reflect, TreatNullAs=NullString] attribute DOMString id;
[TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString namespaceURI;
[TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, SetterRaisesException] attribute DOMString prefix;
[TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString localName;
// Common extensions
[PerWorldBindings] readonly attribute long offsetLeft;
[PerWorldBindings] readonly attribute long offsetTop;
[PerWorldBindings] readonly attribute long offsetWidth;
[PerWorldBindings] readonly attribute long offsetHeight;
[ImplementedAs=bindingsOffsetParent, PerWorldBindings] readonly attribute Element offsetParent;
[PerWorldBindings] readonly attribute long clientLeft;
[PerWorldBindings] readonly attribute long clientTop;
[PerWorldBindings] readonly attribute long clientWidth;
[PerWorldBindings] readonly attribute long clientHeight;
[PerWorldBindings] attribute long scrollLeft;
[PerWorldBindings] attribute long scrollTop;
[PerWorldBindings] readonly attribute long scrollWidth;
[PerWorldBindings] readonly attribute long scrollHeight;
void focus();
void blur();
void scrollIntoView(optional boolean alignWithTop);
// WebKit extensions
void scrollIntoViewIfNeeded(optional boolean centerIfNeeded);
void scrollByLines([Default=Undefined] optional long lines);
void scrollByPages([Default=Undefined] optional long pages);
// HTML 5
NodeList getElementsByClassName([Default=Undefined] optional DOMString name);
[Reflect=class, TreatNullAs=NullString, PerWorldBindings] attribute DOMString className;
[PerWorldBindings] readonly attribute DOMTokenList classList;
[PerWorldBindings] readonly attribute DOMStringMap dataset;
// NodeSelector - Selector API
[RaisesException] Element querySelector(DOMString selectors);
[RaisesException] NodeList querySelectorAll(DOMString selectors);
// WebKit extension, pending specification.
[RaisesException] boolean webkitMatchesSelector([Default=Undefined] optional DOMString selectors);
// Shadow DOM API
[RuntimeEnabled=ShadowDOM, Reflect, TreatNullAs=NullString, PerWorldBindings] attribute DOMString pseudo;
[RuntimeEnabled=ShadowDOM, RaisesException] ShadowRoot createShadowRoot();
[RuntimeEnabled=ShadowDOM, PerWorldBindings] readonly attribute ShadowRoot shadowRoot;
[RuntimeEnabled=ShadowDOM, PerWorldBindings] NodeList getDestinationInsertionPoints();
// To-be-deprecated prefixed Shadow DOM API
[Reflect=pseudo, TreatNullAs=NullString, ImplementedAs=pseudo, PerWorldBindings, MeasureAs=ShadowDOMPrefixedPseudo] attribute DOMString webkitPseudo;
[ImplementedAs=createShadowRoot, RaisesException, MeasureAs=ShadowDOMPrefixedCreateShadowRoot] ShadowRoot webkitCreateShadowRoot();
[ImplementedAs=shadowRoot, PerWorldBindings, MeasureAs=ShadowDOMPrefixedShadowRoot] readonly attribute ShadowRoot webkitShadowRoot;
// CSSOM View Module API
ClientRectList getClientRects();
ClientRect getBoundingClientRect();
// Mozilla version
const unsigned short ALLOW_KEYBOARD_INPUT = 1;
[RuntimeEnabled=Fullscreen, PerWorldBindings, ActivityLogging=AccessForAllWorlds, MeasureAs=PrefixedElementRequestFullScreen] void webkitRequestFullScreen([Default=Undefined] optional unsigned short flags);
// W3C version
[RuntimeEnabled=Fullscreen, PerWorldBindings, ActivityLogging=AccessForAllWorlds, MeasureAs=PrefixedElementRequestFullscreen] void webkitRequestFullscreen();
void webkitRequestPointerLock();
// CSS Regions API
[RuntimeEnabled=CSSRegions, PerWorldBindings] readonly attribute DOMString webkitRegionOverset;
[RuntimeEnabled=CSSRegions] sequence<Range> webkitGetRegionFlowRanges();
// Event handler attributes
attribute EventHandler onbeforecopy;
attribute EventHandler onbeforecut;
attribute EventHandler onbeforepaste;
attribute EventHandler oncopy;
attribute EventHandler oncut;
attribute EventHandler onpaste;
attribute EventHandler onsearch;
attribute EventHandler onselectstart;
[RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
[RuntimeEnabled=Touch] attribute EventHandler ontouchend;
[RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
[RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
attribute EventHandler onwebkitfullscreenchange;
attribute EventHandler onwebkitfullscreenerror;
[ActivityLogging=SetterForAllWorlds] attribute EventHandler onwheel;
};
Element implements ParentNode;
Element implements ChildNode;