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 SpecialWrapFor=(HTMLElement,SVGElement), | 24 TypeChecking=Interface, |
23 ] interface Element : Node { | 25 ] interface Element : Node { |
| 26 readonly attribute DOMString? namespaceURI; |
| 27 readonly attribute DOMString? prefix; |
| 28 readonly attribute DOMString localName; |
| 29 readonly attribute DOMString tagName; |
24 | 30 |
25 // DOM Level 1 Core | 31 [Reflect] attribute DOMString id; |
| 32 [Reflect=class] attribute DOMString className; |
| 33 [SameObject, PerWorldBindings] readonly attribute DOMTokenList classList; |
26 | 34 |
27 readonly attribute DOMString? tagName; | 35 [MeasureAs=HasAttributes] boolean hasAttributes(); |
28 | 36 [SameObject, PerWorldBindings, ImplementedAs=attributesForBindings] readonly
attribute NamedNodeMap attributes; |
29 [DartNoAutoScope] DOMString? getAttribute(DOMString name); | 37 DOMString? getAttribute(DOMString name); |
30 [RaisesException, CustomElementCallbacks, DartNoAutoScope] void setAttribute
(DOMString name, DOMString value); | 38 DOMString? getAttributeNS(DOMString? namespaceURI, DOMString localName); |
| 39 [RaisesException, CustomElementCallbacks] void setAttribute(DOMString name,
DOMString value); |
| 40 [RaisesException, CustomElementCallbacks] void setAttributeNS(DOMString? nam
espaceURI, DOMString name, DOMString value); |
31 [CustomElementCallbacks] void removeAttribute(DOMString name); | 41 [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] optional Attr newAttr); // Removed fr
om DOM4. | |
34 [RaisesException, CustomElementCallbacks, MeasureAs=ElementRemoveAttributeNo
de] Attr removeAttributeNode([Default=Undefined] optional Attr oldAttr); // Remo
ved from DOM4. | |
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 [DartNoAutoScope] DOMString? getAttributeNS(DOMString? namespaceURI, DOMStri
ng localName); | |
43 [RaisesException, CustomElementCallbacks, DartNoAutoScope] void setAttribute
NS(DOMString? namespaceURI, 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([Default=Undef
ined] optional DOMString? namespaceURI, | |
47 [Default=Undef
ined] optional DOMString localName); // Removed from DOM4. | |
48 [RaisesException, CustomElementCallbacks, DeprecateAs=ElementSetAttributeNod
eNS] Attr setAttributeNodeNS([Default=Undefined] optional Attr newAttr); // Remo
ved from DOM4. | |
49 boolean hasAttribute(DOMString name); | 43 boolean hasAttribute(DOMString name); |
50 boolean hasAttributeNS(DOMString? namespaceURI, DOMString localName); | 44 boolean hasAttributeNS(DOMString? namespaceURI, DOMString localName); |
51 | 45 |
52 [PerWorldBindings] readonly attribute CSSStyleDeclaration style; | 46 [MeasureAs=ElementGetAttributeNode] Attr? getAttributeNode(DOMString name); |
| 47 [MeasureAs=ElementGetAttributeNodeNS] Attr? getAttributeNodeNS(DOMString? na
mespaceURI, DOMString localName); |
| 48 [RaisesException, CustomElementCallbacks, MeasureAs=ElementSetAttributeNode]
Attr? setAttributeNode(Attr attr); |
| 49 [RaisesException, CustomElementCallbacks, MeasureAs=ElementSetAttributeNodeN
S] Attr? setAttributeNodeNS(Attr attr); |
| 50 [RaisesException, CustomElementCallbacks, MeasureAs=ElementRemoveAttributeNo
de] Attr removeAttributeNode(Attr attr); |
53 | 51 |
54 // DOM4 | 52 [RaisesException] Element? closest(DOMString selectors); |
55 [Reflect, DartNoAutoScope] attribute DOMString id; | |
56 readonly attribute DOMString? namespaceURI; | |
57 [RaisesException=Setter] attribute DOMString? prefix; | |
58 [DartCustom] readonly attribute DOMString? localName; | |
59 | |
60 [RaisesException] boolean matches(DOMString selectors); | 53 [RaisesException] boolean matches(DOMString selectors); |
61 | 54 |
62 // Common extensions | 55 HTMLCollection getElementsByTagName(DOMString localName); |
| 56 HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString loc
alName); |
| 57 HTMLCollection getElementsByClassName(DOMString classNames); |
63 | 58 |
64 readonly attribute long offsetLeft; | 59 // DOM Parsing and Serialization |
65 readonly attribute long offsetTop; | 60 // https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#extensions-to-th
e-element-interface |
66 readonly attribute long offsetWidth; | 61 [TreatNullAs=NullString, CustomElementCallbacks, RaisesException=Setter] att
ribute DOMString innerHTML; |
67 readonly attribute long offsetHeight; | 62 [TreatNullAs=NullString, CustomElementCallbacks, RaisesException=Setter] att
ribute DOMString outerHTML; |
68 [ImplementedAs=offsetParentForBindings, PerWorldBindings] readonly attribute
Element offsetParent; | 63 [CustomElementCallbacks, RaisesException, MeasureAs=InsertAdjacentHTML] void
insertAdjacentHTML(DOMString position, DOMString text); |
| 64 |
| 65 // Shadow DOM |
| 66 // http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-element-int
erface |
| 67 [RaisesException, CallWith=ScriptState, MeasureAs=ElementCreateShadowRoot] S
hadowRoot createShadowRoot(); |
| 68 [RuntimeEnabled=CreateShadowRootWithParameter, RaisesException, CallWith=Scr
iptState, MeasureAs=ElementCreateShadowRoot] ShadowRoot createShadowRoot(ShadowR
ootInit shadowRootInitDict); |
| 69 NodeList getDestinationInsertionPoints(); |
| 70 [PerWorldBindings] readonly attribute ShadowRoot? shadowRoot; |
| 71 |
| 72 // Pointer Lock |
| 73 // https://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions
-to-the-element-interface |
| 74 [MeasureAs=ElementRequestPointerLock] void requestPointerLock(); |
| 75 |
| 76 // CSSOM View Module |
| 77 // http://dev.w3.org/csswg/cssom-view/#extension-to-the-element-interface |
| 78 // FIXME: getClientRect() and getBoundingClientRect() should |
| 79 // return DOMRectList and DOMRect respectively. |
| 80 ClientRectList getClientRects(); |
| 81 ClientRect getBoundingClientRect(); |
| 82 // FIXME: scrollIntoView() should have a ScrollIntoViewOptions dictionary ar
gument. |
| 83 void scrollIntoView(optional boolean alignWithTop); |
| 84 [RuntimeEnabled=CSSOMSmoothScroll, ImplementedAs=scrollTo] void scroll(optio
nal ScrollToOptions options); |
| 85 [RuntimeEnabled=CSSOMSmoothScroll, ImplementedAs=scrollTo] void scroll(unres
tricted double x, unrestricted double y); |
| 86 [RuntimeEnabled=CSSOMSmoothScroll] void scrollTo(optional ScrollToOptions op
tions); |
| 87 [RuntimeEnabled=CSSOMSmoothScroll] void scrollTo(unrestricted double x, unre
stricted double y); |
| 88 [RuntimeEnabled=CSSOMSmoothScroll] void scrollBy(optional ScrollToOptions op
tions); |
| 89 [RuntimeEnabled=CSSOMSmoothScroll] void scrollBy(unrestricted double x, unre
stricted double y); |
| 90 attribute unrestricted double scrollTop; |
| 91 attribute unrestricted double scrollLeft; |
| 92 readonly attribute long scrollWidth; |
| 93 readonly attribute long scrollHeight; |
| 94 readonly attribute long clientTop; |
69 readonly attribute long clientLeft; | 95 readonly attribute long clientLeft; |
70 readonly attribute long clientTop; | |
71 readonly attribute long clientWidth; | 96 readonly attribute long clientWidth; |
72 readonly attribute long clientHeight; | 97 readonly attribute long clientHeight; |
| 98 // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-htmlelement-interfa
ce |
| 99 // FIXME: offset* should only be on HTMLElement. |
| 100 [MeasureAs=ElementOffsetParent, PerWorldBindings] readonly attribute Element
? offsetParent; |
| 101 [MeasureAs=ElementOffsetTop] readonly attribute long offsetTop; |
| 102 [MeasureAs=ElementOffsetLeft] readonly attribute long offsetLeft; |
| 103 [MeasureAs=ElementOffsetWidth] readonly attribute long offsetWidth; |
| 104 [MeasureAs=ElementOffsetHeight] readonly attribute long offsetHeight; |
73 | 105 |
74 // FIXME: should be: | 106 // Non-standard APIs |
75 // attribute (Dictionary or double) scrollLeft; | 107 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=19962 |
76 // attribute (Dictionary or double) scrollTop; | |
77 // http://crbug.com/240176 | |
78 [Custom=Setter] attribute double scrollLeft; | |
79 [Custom=Setter] attribute double scrollTop; | |
80 readonly attribute long scrollWidth; | |
81 readonly attribute long scrollHeight; | |
82 | |
83 void focus(); | |
84 void blur(); | |
85 void scrollIntoView(optional boolean alignWithTop); | |
86 | |
87 // WebKit extensions | |
88 | |
89 [MeasureAs=ElementScrollIntoViewIfNeeded] void scrollIntoViewIfNeeded(option
al boolean centerIfNeeded); | |
90 | |
91 // HTML 5 | |
92 HTMLCollection getElementsByClassName(DOMString classNames); | |
93 [TreatNullAs=NullString, CustomElementCallbacks, RaisesException=Setter] att
ribute DOMString innerHTML; | |
94 [TreatNullAs=NullString, CustomElementCallbacks, RaisesException=Setter] att
ribute DOMString outerHTML; | |
95 | |
96 [RaisesException, CustomElementCallbacks, MeasureAs=InsertAdjacentElement] E
lement insertAdjacentElement(DOMString where, Element element); | 108 [RaisesException, CustomElementCallbacks, MeasureAs=InsertAdjacentElement] E
lement insertAdjacentElement(DOMString where, Element element); |
97 [RaisesException, MeasureAs=InsertAdjacentText] void insertAdjacentText(DOMS
tring where, DOMString text); | 109 [RaisesException, MeasureAs=InsertAdjacentText] void insertAdjacentText(DOMS
tring where, DOMString text); |
98 [CustomElementCallbacks, RaisesException, MeasureAs=InsertAdjacentHTML] void
insertAdjacentHTML(DOMString where, DOMString html); | 110 [MeasureAs=ElementScrollIntoViewIfNeeded] void scrollIntoViewIfNeeded(option
al boolean centerIfNeeded); |
99 | |
100 [Reflect=class] attribute DOMString className; | |
101 [PerWorldBindings] readonly attribute DOMTokenList classList; | |
102 | |
103 [PerWorldBindings] readonly attribute DOMStringMap dataset; | |
104 | |
105 // WebKit extension | |
106 [RaisesException, ImplementedAs=matches, MeasureAs=ElementPrefixedMatchesSel
ector] boolean webkitMatchesSelector(DOMString selectors); | 111 [RaisesException, ImplementedAs=matches, MeasureAs=ElementPrefixedMatchesSel
ector] boolean webkitMatchesSelector(DOMString selectors); |
107 | 112 |
108 // Shadow DOM API | 113 // Experimental accessibility API |
109 [RaisesException, MeasureAs=ElementCreateShadowRoot] ShadowRoot createShadow
Root(); | 114 [RuntimeEnabled=ComputedAccessibilityInfo] readonly attribute DOMString? com
putedRole; |
110 [PerWorldBindings] readonly attribute ShadowRoot shadowRoot; | 115 [RuntimeEnabled=ComputedAccessibilityInfo] readonly attribute DOMString? com
putedName; |
111 NodeList getDestinationInsertionPoints(); | |
112 | |
113 // CSSOM View Module API | |
114 ClientRectList getClientRects(); | |
115 ClientRect getBoundingClientRect(); | |
116 | |
117 [MeasureAs=ElementRequestPointerLock] void requestPointerLock(); | |
118 | 116 |
119 // Event handler attributes | 117 // Event handler attributes |
120 attribute EventHandler onbeforecopy; | 118 attribute EventHandler onbeforecopy; |
121 attribute EventHandler onbeforecut; | 119 attribute EventHandler onbeforecut; |
122 attribute EventHandler onbeforepaste; | 120 attribute EventHandler onbeforepaste; |
123 attribute EventHandler oncopy; | 121 attribute EventHandler oncopy; |
124 attribute EventHandler oncut; | 122 attribute EventHandler oncut; |
125 attribute EventHandler onpaste; | 123 attribute EventHandler onpaste; |
126 attribute EventHandler onsearch; | 124 attribute EventHandler onsearch; |
127 attribute EventHandler onselectstart; | 125 attribute EventHandler onselectstart; |
128 [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel; | 126 [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel; |
129 [RuntimeEnabled=Touch] attribute EventHandler ontouchend; | 127 [RuntimeEnabled=Touch] attribute EventHandler ontouchend; |
130 [RuntimeEnabled=Touch] attribute EventHandler ontouchmove; | 128 [RuntimeEnabled=Touch] attribute EventHandler ontouchmove; |
131 [RuntimeEnabled=Touch] attribute EventHandler ontouchstart; | 129 [RuntimeEnabled=Touch] attribute EventHandler ontouchstart; |
132 attribute EventHandler onwheel; | 130 attribute EventHandler onwheel; |
133 }; | 131 }; |
134 | 132 |
135 Element implements ParentNode; | 133 Element implements ParentNode; |
136 Element implements ChildNode; | 134 Element implements ChildNode; |
| 135 Element implements NonDocumentTypeChildNode; |
OLD | NEW |