OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 */ | 19 */ |
20 | 20 |
| 21 // https://dom.spec.whatwg.org/#interface-element |
| 22 |
21 [ | 23 [ |
22 TypeChecking=Unrestricted, | 24 TypeChecking=Unrestricted, |
23 ] interface Element : Node { | 25 ] interface Element : Node { |
24 | 26 readonly attribute DOMString? namespaceURI; |
25 // DOM Level 1 Core | 27 readonly attribute DOMString? prefix; |
26 | 28 readonly attribute DOMString? localName; |
27 readonly attribute DOMString? tagName; | 29 readonly attribute DOMString? tagName; |
28 | 30 |
| 31 [Reflect, ExposeJSAccessors] attribute DOMString id; |
| 32 [Reflect=class] attribute DOMString className; |
| 33 [PerWorldBindings] readonly attribute DOMTokenList classList; |
| 34 |
| 35 [MeasureAs=HasAttributes] boolean hasAttributes(); |
| 36 [PerWorldBindings, ImplementedAs=attributesForBindings] readonly attribute N
amedNodeMap attributes; |
29 DOMString? getAttribute(DOMString name); | 37 DOMString? getAttribute(DOMString name); |
| 38 DOMString? getAttributeNS(DOMString? namespaceURI, DOMString localName); |
30 [RaisesException, CustomElementCallbacks] void setAttribute(DOMString name,
DOMString value); | 39 [RaisesException, CustomElementCallbacks] void setAttribute(DOMString name,
DOMString value); |
| 40 [RaisesException, CustomElementCallbacks] void setAttributeNS(DOMString? nam
espaceURI, DOMString qualifiedName, DOMString value); |
31 [CustomElementCallbacks] void removeAttribute(DOMString name); | 41 [CustomElementCallbacks] void removeAttribute(DOMString name); |
32 [MeasureAs=ElementGetAttributeNode] Attr getAttributeNode(DOMString name); | |
33 [RaisesException, CustomElementCallbacks, MeasureAs=ElementSetAttributeNode]
Attr setAttributeNode(Attr newAttr); | |
34 [RaisesException, CustomElementCallbacks, MeasureAs=ElementRemoveAttributeNo
de] Attr removeAttributeNode(Attr oldAttr); | |
35 HTMLCollection getElementsByTagName(DOMString name); | |
36 | |
37 [PerWorldBindings, ImplementedAs=attributesForBindings] readonly attribute N
amedNodeMap attributes; | |
38 [MeasureAs=HasAttributes] boolean hasAttributes(); | |
39 | |
40 // DOM Level 2 Core | |
41 | |
42 DOMString? getAttributeNS(DOMString? namespaceURI, DOMString localName); | |
43 [RaisesException, CustomElementCallbacks] void setAttributeNS(DOMString? nam
espaceURI, DOMString qualifiedName, DOMString value); | |
44 [CustomElementCallbacks] void removeAttributeNS(DOMString? namespaceURI, DOM
String localName); | 42 [CustomElementCallbacks] void removeAttributeNS(DOMString? namespaceURI, DOM
String localName); |
45 HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString loc
alName); | |
46 [MeasureAs=ElementGetAttributeNodeNS] Attr getAttributeNodeNS(DOMString? nam
espaceURI, DOMString localName); | |
47 [RaisesException, CustomElementCallbacks, MeasureAs=ElementSetAttributeNodeN
S] Attr setAttributeNodeNS(Attr newAttr); | |
48 boolean hasAttribute(DOMString name); | 43 boolean hasAttribute(DOMString name); |
49 boolean hasAttributeNS(DOMString? namespaceURI, DOMString localName); | 44 boolean hasAttributeNS(DOMString? namespaceURI, DOMString localName); |
50 | 45 |
| 46 [MeasureAs=ElementGetAttributeNode] Attr getAttributeNode(DOMString name); |
| 47 [MeasureAs=ElementGetAttributeNodeNS] Attr getAttributeNodeNS(DOMString? nam
espaceURI, DOMString localName); |
| 48 [RaisesException, CustomElementCallbacks, MeasureAs=ElementSetAttributeNode]
Attr setAttributeNode(Attr newAttr); |
| 49 [RaisesException, CustomElementCallbacks, MeasureAs=ElementSetAttributeNodeN
S] Attr setAttributeNodeNS(Attr newAttr); |
| 50 [RaisesException, CustomElementCallbacks, MeasureAs=ElementRemoveAttributeNo
de] Attr removeAttributeNode(Attr oldAttr); |
| 51 |
| 52 [RaisesException] Element closest(DOMString selectors); |
| 53 [RaisesException] boolean matches(DOMString selectors); |
| 54 |
| 55 HTMLCollection getElementsByTagName(DOMString name); |
| 56 HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString loc
alName); |
| 57 HTMLCollection getElementsByClassName(DOMString classNames); |
| 58 |
| 59 // DOM Parsing and Serialization |
| 60 // https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#extensions-to-th
e-element-interface |
| 61 [TreatNullAs=NullString, CustomElementCallbacks, RaisesException=Setter, Exp
oseJSAccessors] attribute DOMString innerHTML; |
| 62 [TreatNullAs=NullString, CustomElementCallbacks, RaisesException=Setter] att
ribute DOMString outerHTML; |
| 63 [CustomElementCallbacks, RaisesException, MeasureAs=InsertAdjacentHTML] void
insertAdjacentHTML(DOMString where, DOMString html); |
| 64 |
| 65 // Shadow DOM |
| 66 // http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-element-int
erface |
| 67 [RaisesException, MeasureAs=ElementCreateShadowRoot] ShadowRoot createShadow
Root(); |
| 68 NodeList getDestinationInsertionPoints(); |
| 69 [PerWorldBindings] readonly attribute ShadowRoot shadowRoot; |
| 70 |
| 71 // Pointer Lock |
| 72 // https://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions
-to-the-element-interface |
| 73 [MeasureAs=ElementRequestPointerLock] void requestPointerLock(); |
| 74 |
| 75 // CSSOM View Module |
| 76 // http://dev.w3.org/csswg/cssom-view/#extension-to-the-element-interface |
| 77 ClientRectList getClientRects(); |
| 78 ClientRect getBoundingClientRect(); |
| 79 void scrollIntoView(optional boolean alignWithTop); |
| 80 [RuntimeEnabled=CSSOMSmoothScroll, ImplementedAs=scrollTo] void scroll(optio
nal ScrollToOptions scrollToOptions); |
| 81 [RuntimeEnabled=CSSOMSmoothScroll, ImplementedAs=scrollTo] void scroll(unres
tricted double x, unrestricted double y); |
| 82 [RuntimeEnabled=CSSOMSmoothScroll] void scrollTo(optional ScrollToOptions sc
rollToOptions); |
| 83 [RuntimeEnabled=CSSOMSmoothScroll] void scrollTo(unrestricted double x, unre
stricted double y); |
| 84 [RuntimeEnabled=CSSOMSmoothScroll] void scrollBy(optional ScrollToOptions sc
rollToOptions); |
| 85 [RuntimeEnabled=CSSOMSmoothScroll] void scrollBy(unrestricted double x, unre
stricted double y); |
| 86 attribute unrestricted double scrollTop; |
| 87 attribute unrestricted double scrollLeft; |
| 88 readonly attribute long scrollWidth; |
| 89 readonly attribute long scrollHeight; |
| 90 readonly attribute long clientTop; |
| 91 readonly attribute long clientLeft; |
| 92 readonly attribute long clientWidth; |
| 93 readonly attribute long clientHeight; |
| 94 // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-htmlelement-interfa
ce |
| 95 // FIXME: offset* should be on HTMLElement. |
| 96 [ImplementedAs=offsetParentForBindings, PerWorldBindings] readonly attribute
Element offsetParent; |
| 97 readonly attribute long offsetTop; |
| 98 readonly attribute long offsetLeft; |
| 99 readonly attribute long offsetWidth; |
| 100 readonly attribute long offsetHeight; |
| 101 |
| 102 // CSS Object Model (CSSOM) |
| 103 // http://dev.w3.org/csswg/cssom/#the-elementcssinlinestyle-interface |
| 104 // FIXME: style should be on HTMLElement and SVGElement. |
51 [PerWorldBindings] readonly attribute CSSStyleDeclaration style; | 105 [PerWorldBindings] readonly attribute CSSStyleDeclaration style; |
52 | 106 |
53 // DOM4 | 107 // HTML |
54 [Reflect, ExposeJSAccessors] attribute DOMString id; | 108 // https://html.spec.whatwg.org/#htmlelement |
55 readonly attribute DOMString? namespaceURI; | 109 // FIXME: dataset, focus() and blur() should be on HTMLElement. |
56 readonly attribute DOMString? prefix; | 110 [PerWorldBindings] readonly attribute DOMStringMap dataset; |
57 readonly attribute DOMString? localName; | |
58 | |
59 [RaisesException] boolean matches(DOMString selectors); | |
60 [RaisesException] Element closest(DOMString selectors); | |
61 | |
62 // Common extensions | |
63 | |
64 readonly attribute long offsetLeft; | |
65 readonly attribute long offsetTop; | |
66 readonly attribute long offsetWidth; | |
67 readonly attribute long offsetHeight; | |
68 [ImplementedAs=offsetParentForBindings, PerWorldBindings] readonly attribute
Element offsetParent; | |
69 readonly attribute long clientLeft; | |
70 readonly attribute long clientTop; | |
71 readonly attribute long clientWidth; | |
72 readonly attribute long clientHeight; | |
73 | |
74 attribute unrestricted double scrollLeft; | |
75 attribute unrestricted double scrollTop; | |
76 readonly attribute long scrollWidth; | |
77 readonly attribute long scrollHeight; | |
78 | |
79 [RuntimeEnabled=CSSOMSmoothScroll, ImplementedAs=scrollTo] void scroll(unres
tricted double x, unrestricted double y); | |
80 [RuntimeEnabled=CSSOMSmoothScroll, ImplementedAs=scrollTo] void scroll(optio
nal ScrollToOptions scrollToOptions); | |
81 [RuntimeEnabled=CSSOMSmoothScroll] void scrollTo(unrestricted double x, unre
stricted double y); | |
82 [RuntimeEnabled=CSSOMSmoothScroll] void scrollTo(optional ScrollToOptions sc
rollToOptions); | |
83 [RuntimeEnabled=CSSOMSmoothScroll] void scrollBy(unrestricted double x, unre
stricted double y); | |
84 [RuntimeEnabled=CSSOMSmoothScroll] void scrollBy(optional ScrollToOptions sc
rollToOptions); | |
85 | |
86 void focus(); | 111 void focus(); |
87 void blur(); | 112 void blur(); |
88 void scrollIntoView(optional boolean alignWithTop); | |
89 | 113 |
90 // WebKit extensions | 114 // Non-standard APIs |
91 | 115 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=19962 |
92 [MeasureAs=ElementScrollIntoViewIfNeeded] void scrollIntoViewIfNeeded(option
al boolean centerIfNeeded); | |
93 | |
94 // HTML 5 | |
95 HTMLCollection getElementsByClassName(DOMString classNames); | |
96 [TreatNullAs=NullString, CustomElementCallbacks, RaisesException=Setter, Exp
oseJSAccessors] attribute DOMString innerHTML; | |
97 [TreatNullAs=NullString, CustomElementCallbacks, RaisesException=Setter] att
ribute DOMString outerHTML; | |
98 | |
99 [RaisesException, CustomElementCallbacks, MeasureAs=InsertAdjacentElement] E
lement insertAdjacentElement(DOMString where, Element element); | 116 [RaisesException, CustomElementCallbacks, MeasureAs=InsertAdjacentElement] E
lement insertAdjacentElement(DOMString where, Element element); |
100 [RaisesException, MeasureAs=InsertAdjacentText] void insertAdjacentText(DOMS
tring where, DOMString text); | 117 [RaisesException, MeasureAs=InsertAdjacentText] void insertAdjacentText(DOMS
tring where, DOMString text); |
101 [CustomElementCallbacks, RaisesException, MeasureAs=InsertAdjacentHTML] void
insertAdjacentHTML(DOMString where, DOMString html); | 118 [MeasureAs=ElementScrollIntoViewIfNeeded] void scrollIntoViewIfNeeded(option
al boolean centerIfNeeded); |
102 | |
103 [Reflect=class] attribute DOMString className; | |
104 [PerWorldBindings] readonly attribute DOMTokenList classList; | |
105 | |
106 [PerWorldBindings] readonly attribute DOMStringMap dataset; | |
107 | |
108 // WebKit extension | |
109 [RaisesException, ImplementedAs=matches, MeasureAs=ElementPrefixedMatchesSel
ector] boolean webkitMatchesSelector(DOMString selectors); | 119 [RaisesException, ImplementedAs=matches, MeasureAs=ElementPrefixedMatchesSel
ector] boolean webkitMatchesSelector(DOMString selectors); |
110 | 120 |
111 // Shadow DOM API | 121 // Experimental isTapStop API |
112 [RaisesException, MeasureAs=ElementCreateShadowRoot] ShadowRoot createShadow
Root(); | |
113 [PerWorldBindings] readonly attribute ShadowRoot shadowRoot; | |
114 NodeList getDestinationInsertionPoints(); | |
115 [RuntimeEnabled=IsTabStopAttribute] attribute boolean isTabStop; | 122 [RuntimeEnabled=IsTabStopAttribute] attribute boolean isTabStop; |
116 | 123 |
117 // CSSOM View Module API | |
118 ClientRectList getClientRects(); | |
119 ClientRect getBoundingClientRect(); | |
120 | |
121 [MeasureAs=ElementRequestPointerLock] void requestPointerLock(); | |
122 | |
123 // Experimental accessibility API | 124 // Experimental accessibility API |
124 [RuntimeEnabled=ComputedAccessibilityInfo] readonly attribute DOMString? com
putedRole; | 125 [RuntimeEnabled=ComputedAccessibilityInfo] readonly attribute DOMString? com
putedRole; |
125 [RuntimeEnabled=ComputedAccessibilityInfo] readonly attribute DOMString? com
putedName; | 126 [RuntimeEnabled=ComputedAccessibilityInfo] readonly attribute DOMString? com
putedName; |
126 | 127 |
127 // Event handler attributes | 128 // Event handler attributes |
128 attribute EventHandler onbeforecopy; | 129 attribute EventHandler onbeforecopy; |
129 attribute EventHandler onbeforecut; | 130 attribute EventHandler onbeforecut; |
130 attribute EventHandler onbeforepaste; | 131 attribute EventHandler onbeforepaste; |
131 attribute EventHandler oncopy; | 132 attribute EventHandler oncopy; |
132 attribute EventHandler oncut; | 133 attribute EventHandler oncut; |
133 attribute EventHandler onpaste; | 134 attribute EventHandler onpaste; |
134 attribute EventHandler onsearch; | 135 attribute EventHandler onsearch; |
135 attribute EventHandler onselectstart; | 136 attribute EventHandler onselectstart; |
136 [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel; | 137 [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel; |
137 [RuntimeEnabled=Touch] attribute EventHandler ontouchend; | 138 [RuntimeEnabled=Touch] attribute EventHandler ontouchend; |
138 [RuntimeEnabled=Touch] attribute EventHandler ontouchmove; | 139 [RuntimeEnabled=Touch] attribute EventHandler ontouchmove; |
139 [RuntimeEnabled=Touch] attribute EventHandler ontouchstart; | 140 [RuntimeEnabled=Touch] attribute EventHandler ontouchstart; |
140 attribute EventHandler onwheel; | 141 attribute EventHandler onwheel; |
141 }; | 142 }; |
142 | 143 |
143 Element implements ParentNode; | 144 Element implements ParentNode; |
144 Element implements ChildNode; | 145 Element implements ChildNode; |
145 Element implements NonDocumentTypeChildNode; | 146 Element implements NonDocumentTypeChildNode; |
OLD | NEW |