• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4 *
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.
9 *
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.
14 *
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.
19 */
20
21[
22    SpecialWrapFor=HTMLElement|SVGElement
23] interface Element : Node {
24
25    // DOM Level 1 Core
26
27    [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString tagName;
28
29    [TreatReturnedNullStringAs=Null] DOMString getAttribute(DOMString name);
30    [RaisesException, CustomElementCallbacks] void setAttribute(DOMString name, DOMString value);
31    [CustomElementCallbacks] void removeAttribute(DOMString name);
32    [MeasureAs=ElementGetAttributeNode] Attr getAttributeNode([Default=Undefined] optional DOMString name); // Removed from DOM4.
33    [RaisesException, CustomElementCallbacks, MeasureAs=ElementSetAttributeNode] Attr setAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr newAttr); // Removed from DOM4.
34    [RaisesException, CustomElementCallbacks, MeasureAs=ElementRemoveAttributeNode] Attr removeAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr oldAttr); // Removed from DOM4.
35    [PerWorldBindings] NodeList getElementsByTagName(DOMString name);
36
37    [PerWorldBindings] readonly attribute NamedNodeMap     attributes;
38    [MeasureAs=HasAttributes] boolean hasAttributes();
39
40    // DOM Level 2 Core
41
42    DOMString getAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName);
43    [RaisesException, CustomElementCallbacks] void setAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString qualifiedName, DOMString value);
44    [CustomElementCallbacks] void removeAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName);
45    NodeList getElementsByTagNameNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName);
46    [MeasureAs=ElementGetAttributeNodeNS] Attr getAttributeNodeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
47                                                                  [Default=Undefined] optional DOMString localName); // Removed from DOM4.
48    [RaisesException, CustomElementCallbacks, MeasureAs=ElementSetAttributeNodeNS] Attr setAttributeNodeNS([Default=Undefined, StrictTypeChecking] optional Attr newAttr); // Removed from DOM4.
49    boolean hasAttribute(DOMString name);
50    boolean hasAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, DOMString localName);
51
52    [PerWorldBindings] readonly attribute CSSStyleDeclaration style;
53
54    // DOM4
55    [Reflect] attribute DOMString id;
56    [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString namespaceURI;
57    [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, RaisesException=Setter] attribute DOMString prefix;
58    [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString localName;
59
60    // Common extensions
61
62    [PerWorldBindings] readonly attribute long offsetLeft;
63    [PerWorldBindings] readonly attribute long offsetTop;
64    [PerWorldBindings] readonly attribute long offsetWidth;
65    [PerWorldBindings] readonly attribute long offsetHeight;
66    [ImplementedAs=bindingsOffsetParent, PerWorldBindings] readonly attribute Element offsetParent;
67    [PerWorldBindings] readonly attribute long clientLeft;
68    [PerWorldBindings] readonly attribute long clientTop;
69    [PerWorldBindings] readonly attribute long clientWidth;
70    [PerWorldBindings] readonly attribute long clientHeight;
71    [PerWorldBindings] attribute long scrollLeft;
72    [PerWorldBindings] attribute long scrollTop;
73    [PerWorldBindings] readonly attribute long scrollWidth;
74    [PerWorldBindings] readonly attribute long scrollHeight;
75
76    void focus();
77    void blur();
78    void scrollIntoView(optional boolean alignWithTop);
79
80    // WebKit extensions
81
82    void scrollIntoViewIfNeeded(optional boolean centerIfNeeded);
83    void scrollByLines([Default=Undefined] optional long lines);
84    void scrollByPages([Default=Undefined] optional long pages);
85
86    // HTML 5
87    NodeList getElementsByClassName(DOMString classNames);
88    [TreatNullAs=NullString, CustomElementCallbacks, PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds, RaisesException=Setter] attribute DOMString innerHTML;
89    [TreatNullAs=NullString, CustomElementCallbacks, RaisesException=Setter] attribute DOMString outerHTML;
90    [CustomElementCallbacks, RaisesException] void insertAdjacentHTML(DOMString where, DOMString html);
91
92    [Reflect=class, PerWorldBindings] attribute DOMString className;
93    [PerWorldBindings] readonly attribute DOMTokenList classList;
94
95    [PerWorldBindings] readonly attribute DOMStringMap dataset;
96
97    // NodeSelector - Selector API
98    [RaisesException] Element querySelector(DOMString selectors);
99    [RaisesException] NodeList querySelectorAll(DOMString selectors);
100
101    // WebKit extension
102    [RaisesException, MeasureAs=ElementPrefixedMatchesSelector] boolean webkitMatchesSelector([Default=Undefined] optional DOMString selectors);
103
104    // Shadow DOM API
105    [RuntimeEnabled=ShadowDOM, Reflect, TreatNullAs=NullString, PerWorldBindings] attribute DOMString pseudo;
106    [RuntimeEnabled=ShadowDOM, RaisesException] ShadowRoot createShadowRoot();
107    [RuntimeEnabled=ShadowDOM, PerWorldBindings] readonly attribute ShadowRoot shadowRoot;
108    [RuntimeEnabled=ShadowDOM, PerWorldBindings] NodeList getDestinationInsertionPoints();
109
110    // To-be-deprecated prefixed Shadow DOM API
111    [Reflect=pseudo, TreatNullAs=NullString, ImplementedAs=pseudo, PerWorldBindings, MeasureAs=ShadowDOMPrefixedPseudo] attribute DOMString webkitPseudo;
112    [ImplementedAs=createShadowRoot, RaisesException, MeasureAs=ShadowDOMPrefixedCreateShadowRoot] ShadowRoot webkitCreateShadowRoot();
113    [ImplementedAs=shadowRoot, PerWorldBindings, MeasureAs=ShadowDOMPrefixedShadowRoot] readonly attribute ShadowRoot webkitShadowRoot;
114
115    // CSSOM View Module API
116    ClientRectList getClientRects();
117    ClientRect getBoundingClientRect();
118
119    // Mozilla version
120    const unsigned short ALLOW_KEYBOARD_INPUT = 1;
121    [RuntimeEnabled=Fullscreen, PerWorldBindings, ActivityLogging=ForAllWorlds, MeasureAs=PrefixedElementRequestFullScreen] void webkitRequestFullScreen([Default=Undefined] optional unsigned short flags);
122
123    // W3C version
124    [RuntimeEnabled=Fullscreen, PerWorldBindings, ActivityLogging=ForAllWorlds, MeasureAs=PrefixedElementRequestFullscreen] void webkitRequestFullscreen();
125
126    void webkitRequestPointerLock();
127
128    // CSS Regions API
129    [RuntimeEnabled=CSSRegions, PerWorldBindings] readonly attribute DOMString webkitRegionOverset;
130    [RuntimeEnabled=CSSRegions] sequence<Range> webkitGetRegionFlowRanges();
131
132    // Event handler attributes
133    attribute EventHandler onbeforecopy;
134    attribute EventHandler onbeforecut;
135    attribute EventHandler onbeforepaste;
136    attribute EventHandler oncopy;
137    attribute EventHandler oncut;
138    attribute EventHandler onpaste;
139    attribute EventHandler onsearch;
140    attribute EventHandler onselectstart;
141    [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
142    [RuntimeEnabled=Touch] attribute EventHandler ontouchend;
143    [RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
144    [RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
145    attribute EventHandler onwebkitfullscreenchange;
146    attribute EventHandler onwebkitfullscreenerror;
147    [PerWorldBindings, ActivityLogging=SetterForIsolatedWorlds] attribute EventHandler onwheel;
148};
149
150Element implements ParentNode;
151Element implements ChildNode;
152