1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://dom.spec.whatwg.org/#element and
* https://w3c.github.io/DOM-Parsing/ and
* http://dev.w3.org/csswg/cssom-view/ and
* http://www.w3.org/TR/selectors-api/
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
[Exposed=Window]
interface Element : Node {
[Constant]
readonly attribute DOMString? namespaceURI;
[Constant]
readonly attribute DOMString? prefix;
[Constant]
readonly attribute DOMString localName;
// Not [Constant] because it depends on which document we're in
[Pure]
readonly attribute DOMString tagName;
[CEReactions, Pure]
attribute DOMString id;
[CEReactions, Pure]
attribute DOMString className;
[SameObject, PutForwards=value]
readonly attribute DOMTokenList classList;
[Pure]
boolean hasAttributes();
[SameObject]
readonly attribute NamedNodeMap attributes;
[Pure]
sequence<DOMString> getAttributeNames();
[Pure]
DOMString? getAttribute(DOMString name);
[Pure]
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions, Throws]
boolean toggleAttribute(DOMString name, optional boolean force);
[CEReactions, Throws]
void setAttribute(DOMString name, DOMString value);
[CEReactions, Throws]
void setAttributeNS(DOMString? namespace, DOMString name, DOMString value);
[CEReactions]
void removeAttribute(DOMString name);
[CEReactions]
void removeAttributeNS(DOMString? namespace, DOMString localName);
boolean hasAttribute(DOMString name);
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
[Pure]
Attr? getAttributeNode(DOMString name);
[Pure]
Attr? getAttributeNodeNS(DOMString? namespace, DOMString localName);
[CEReactions, Throws]
Attr? setAttributeNode(Attr attr);
[CEReactions, Throws]
Attr? setAttributeNodeNS(Attr attr);
[CEReactions, Throws]
Attr removeAttributeNode(Attr oldAttr);
[Pure, Throws]
Element? closest(DOMString selectors);
[Pure, Throws]
boolean matches(DOMString selectors);
[Pure, Throws]
boolean webkitMatchesSelector(DOMString selectors); // historical alias of .matches
HTMLCollection getElementsByTagName(DOMString localName);
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
HTMLCollection getElementsByClassName(DOMString classNames);
[CEReactions, Throws]
Element? insertAdjacentElement(DOMString where_, Element element); // historical
[Throws]
void insertAdjacentText(DOMString where_, DOMString data);
[CEReactions, Throws]
void insertAdjacentHTML(DOMString position, DOMString html);
[Throws, Pref="dom.shadowdom.enabled"] ShadowRoot attachShadow();
};
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface
partial interface Element {
sequence<DOMRect> getClientRects();
[NewObject]
DOMRect getBoundingClientRect();
void scroll(optional ScrollToOptions options = {});
void scroll(unrestricted double x, unrestricted double y);
void scrollTo(optional ScrollToOptions options = {});
void scrollTo(unrestricted double x, unrestricted double y);
void scrollBy(optional ScrollToOptions options = {});
void scrollBy(unrestricted double x, unrestricted double y);
attribute unrestricted double scrollTop;
attribute unrestricted double scrollLeft;
readonly attribute long scrollWidth;
readonly attribute long scrollHeight;
readonly attribute long clientTop;
readonly attribute long clientLeft;
readonly attribute long clientWidth;
readonly attribute long clientHeight;
};
// https://w3c.github.io/DOM-Parsing/#extensions-to-the-element-interface
partial interface Element {
[CEReactions, Throws]
attribute [TreatNullAs=EmptyString] DOMString innerHTML;
[CEReactions, Throws]
attribute [TreatNullAs=EmptyString] DOMString outerHTML;
};
// https://fullscreen.spec.whatwg.org/#api
partial interface Element {
Promise<void> requestFullscreen();
};
Element includes ChildNode;
Element includes NonDocumentTypeChildNode;
Element includes ParentNode;
Element includes ActivatableElement;
|