6f405f3e420c93922c8dc46fab32ded74b769d9f
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / dom / Element.idl
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 interface Element : Node {
22
23     // DOM Level 1 Core
24
25     readonly attribute DOMString? tagName;
26
27     DOMString? getAttribute(DOMString name);
28     [RaisesException, CustomElementCallbacks] void setAttribute(DOMString name, DOMString value);
29     [CustomElementCallbacks] void removeAttribute(DOMString name);
30     [MeasureAs=ElementGetAttributeNode] Attr getAttributeNode([Default=Undefined] optional DOMString name); // Removed from DOM4.
31     [RaisesException, CustomElementCallbacks, MeasureAs=ElementSetAttributeNode] Attr setAttributeNode([Default=Undefined] optional Attr newAttr); // Removed from DOM4.
32     [RaisesException, CustomElementCallbacks, MeasureAs=ElementRemoveAttributeNode] Attr removeAttributeNode([Default=Undefined] optional Attr oldAttr); // Removed from DOM4.
33     HTMLCollection getElementsByTagName(DOMString name);
34
35     [PerWorldBindings, ImplementedAs=attributesForBindings] readonly attribute NamedNodeMap     attributes;
36     [MeasureAs=HasAttributes] boolean hasAttributes();
37
38     // DOM Level 2 Core
39
40     DOMString? getAttributeNS(DOMString? namespaceURI, DOMString localName);
41     [RaisesException, CustomElementCallbacks] void setAttributeNS(DOMString? namespaceURI, DOMString qualifiedName, DOMString value);
42     [CustomElementCallbacks] void removeAttributeNS(DOMString? namespaceURI, DOMString localName);
43     HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);
44     [MeasureAs=ElementGetAttributeNodeNS] Attr getAttributeNodeNS([Default=Undefined] optional DOMString? namespaceURI,
45                                                                   [Default=Undefined] optional DOMString localName); // Removed from DOM4.
46     [RaisesException, CustomElementCallbacks, DeprecateAs=ElementSetAttributeNodeNS] Attr setAttributeNodeNS([Default=Undefined] optional Attr newAttr); // Removed from DOM4.
47     boolean hasAttribute(DOMString name);
48     boolean hasAttributeNS(DOMString? namespaceURI, DOMString localName);
49
50     [PerWorldBindings] readonly attribute CSSStyleDeclaration style;
51
52     // DOM4
53     [Reflect] attribute DOMString id;
54     readonly attribute DOMString? namespaceURI;
55     [RaisesException=Setter] attribute DOMString? prefix;
56     readonly attribute DOMString? localName;
57
58     [RaisesException] boolean matches(DOMString selectors);
59
60     // Common extensions
61
62     readonly attribute long offsetLeft;
63     readonly attribute long offsetTop;
64     readonly attribute long offsetWidth;
65     readonly attribute long offsetHeight;
66     [ImplementedAs=offsetParentForBindings, PerWorldBindings] readonly attribute Element offsetParent;
67     readonly attribute long clientLeft;
68     readonly attribute long clientTop;
69     readonly attribute long clientWidth;
70     readonly attribute long clientHeight;
71
72     // FIXME: should be:
73     // attribute (Dictionary or double) scrollLeft;
74     // attribute (Dictionary or double) scrollTop;
75     // http://crbug.com/240176
76     [Custom=Setter] attribute double scrollLeft;
77     [Custom=Setter] attribute double scrollTop;
78     readonly attribute long scrollWidth;
79     readonly attribute long scrollHeight;
80
81     void focus();
82     void blur();
83     void scrollIntoView(optional boolean alignWithTop);
84
85     // WebKit extensions
86
87     [MeasureAs=ElementScrollIntoViewIfNeeded] void scrollIntoViewIfNeeded(optional boolean centerIfNeeded);
88
89     // HTML 5
90     HTMLCollection getElementsByClassName(DOMString classNames);
91     [TreatNullAs=NullString, CustomElementCallbacks, RaisesException=Setter] attribute DOMString innerHTML;
92     [TreatNullAs=NullString, CustomElementCallbacks, RaisesException=Setter] attribute DOMString outerHTML;
93
94     [RaisesException, CustomElementCallbacks, MeasureAs=InsertAdjacentElement] Element insertAdjacentElement(DOMString where, Element element);
95     [RaisesException, MeasureAs=InsertAdjacentText] void insertAdjacentText(DOMString where, DOMString text);
96     [CustomElementCallbacks, RaisesException, MeasureAs=InsertAdjacentHTML] void insertAdjacentHTML(DOMString where, DOMString html);
97
98     [Reflect=class] attribute DOMString className;
99     [PerWorldBindings] readonly attribute DOMTokenList classList;
100
101     [PerWorldBindings] readonly attribute DOMStringMap dataset;
102
103     // WebKit extension
104     [RaisesException, ImplementedAs=matches, MeasureAs=ElementPrefixedMatchesSelector] boolean webkitMatchesSelector(DOMString selectors);
105
106     // Shadow DOM API
107     [RaisesException, MeasureAs=ElementCreateShadowRoot] ShadowRoot createShadowRoot();
108     [PerWorldBindings] readonly attribute ShadowRoot shadowRoot;
109     NodeList getDestinationInsertionPoints();
110
111     // CSSOM View Module API
112     ClientRectList getClientRects();
113     ClientRect getBoundingClientRect();
114
115     [MeasureAs=ElementRequestPointerLock] void requestPointerLock();
116
117     // Event handler attributes
118     attribute EventHandler onbeforecopy;
119     attribute EventHandler onbeforecut;
120     attribute EventHandler onbeforepaste;
121     attribute EventHandler oncopy;
122     attribute EventHandler oncut;
123     attribute EventHandler onpaste;
124     attribute EventHandler onsearch;
125     attribute EventHandler onselectstart;
126     [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
127     [RuntimeEnabled=Touch] attribute EventHandler ontouchend;
128     [RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
129     [RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
130     attribute EventHandler onwheel;
131 };
132
133 Element implements ParentNode;
134 Element implements ChildNode;