pseudo-dom 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,371 +1,371 @@
1
- /**
2
- * @file Substitute for the DOM Element Class.
3
- * @author Joshua Heagle <joshuaheagle@gmail.com>
4
- * @version 1.0.0
5
- */
6
- import { PseudoNode } from '../interfaces/PseudoNode';
7
- import { PseudoElement } from '../interfaces/PseudoElement';
8
- import { NodeService } from './NodeService';
9
- import { PseudoNamedNodeMap } from '../interfaces/PseudoNamedNodeMap';
10
- import { PseudoDOMTokenList } from '../interfaces/PseudoDOMTokenList';
11
- import { PseudoHTMLCollection } from '../interfaces/PseudoHTMLCollection';
12
- import { PseudoShadowRoot } from '../interfaces/PseudoShadowRoot';
13
- type attribute = {
14
- name: string;
15
- value: any;
16
- };
17
- type DOMRect = {
18
- x: number;
19
- y: number;
20
- width: number;
21
- height: number;
22
- top: number;
23
- right: number;
24
- bottom: number;
25
- left: number;
26
- };
27
- /**
28
- * Simulate the behaviour of the Element Class when there is no DOM available.
29
- * @author Joshua Heagle <joshuaheagle@gmail.com>
30
- * @class
31
- * @augments PseudoNode
32
- * @property {string} tagName
33
- * @property {string} className
34
- * @property {string} id
35
- * @property {string} innerHtml
36
- * @property {Array} attributes
37
- * @property {function} hasAttribute
38
- * @property {function} setAttribute
39
- * @property {function} getAttribute
40
- * @property {function} removeAttribute
41
- */
42
- export declare class ElementService extends NodeService implements Partial<PseudoElement> {
43
- id: string;
44
- type: string;
45
- clientHeight: number;
46
- clientLeft: number;
47
- clientTop: number;
48
- clientWidth: number;
49
- scrollHeight: number;
50
- scrollLeft: number;
51
- scrollTop: number;
52
- scrollWidth: number;
53
- /** What getBoundingClientRect() returns - not really computed (there is no layout engine), set this directly. */
54
- boundingClientRect: DOMRect;
55
- /** What getClientRects() returns - set this directly. */
56
- clientRects: Array<DOMRect>;
57
- /** What getAnimations() returns - set this directly. */
58
- animations: Array<any>;
59
- /** What checkVisibility() returns - set this directly. */
60
- isVisible: boolean;
61
- private readonly tag;
62
- private readonly attributeList;
63
- private readonly propertyAttributes;
64
- private readonly tokenList;
65
- private readonly capturedPointers;
66
- private shadowRootInstance;
67
- private defaultEventApplied;
68
- /**
69
- * @param {Object} [settings={}]
70
- * @param {string} [settings.tagName=''] The name of the tag this element represents
71
- * @param {Array<{name: string, value: *}>} [settings.attributes=[]] The attributes (also assigned as properties) to start with
72
- * @param {PseudoNode|null} [settings.parent=null] The node to add this element to as its last child
73
- * @param {Array<PseudoNode>} [settings.children=[]] The nodes to start as children
74
- * @constructor
75
- */
76
- constructor({ tagName, attributes, parent, children }?: {
77
- tagName?: string;
78
- attributes?: Array<attribute>;
79
- parent?: PseudoNode | null;
80
- children?: Array<any>;
81
- });
82
- /**
83
- * The attributes with the values they have now: the ones which are also properties (className, id, style, ...) can
84
- * have been changed through the property, which does not change the stored list.
85
- * @returns {Array<{name: string, value: *}>}
86
- */
87
- private currentAttributes;
88
- get nodeName(): string;
89
- /**
90
- * A copy of this element without its children: the same tag and attributes (the values which are objects, such as
91
- * style, are copied too rather than shared), but not its parent or listeners.
92
- * @returns {ElementService}
93
- */
94
- protected cloneShallow(): NodeService;
95
- /**
96
- * Elements are equal when they have the same tag and the same attributes (in any order), which is what isEqualNode
97
- * checks before it compares the children.
98
- * @param {NodeService} other The element to compare with
99
- * @returns {boolean}
100
- */
101
- protected equalsShallow(other: NodeService): boolean;
102
- get tagName(): string;
103
- /**
104
- * The local part of the element's qualified name. There is no real namespace parsing here, so this is always the
105
- * same as tagName.
106
- * @returns {string}
107
- */
108
- get localName(): string;
109
- /**
110
- * The element's namespace prefix, or null when it has none. There is no real namespace parsing here, so this is
111
- * always null.
112
- * @returns {string|null}
113
- */
114
- get prefix(): string | null;
115
- /**
116
- * The HTML markup of this element's children. Only the getter is here (the setter, which needs to build new
117
- * elements from parsed HTML, is on HTMLElementService - see its class comment).
118
- * @returns {string}
119
- */
120
- get innerHTML(): string;
121
- /**
122
- * The HTML markup of this element itself, including its children. Only the getter is here (see innerHTML).
123
- * @returns {string}
124
- */
125
- get outerHTML(): string;
126
- get nodeType(): number;
127
- get attributes(): PseudoNamedNodeMap;
128
- get classList(): PseudoDOMTokenList;
129
- get className(): string;
130
- set className(className: string);
131
- /**
132
- * Some elements have default behaviour, this registers it when the element is added.
133
- * @returns {Function}
134
- */
135
- /**
136
- * A live view of this element's element children (text, comments and the like are not included).
137
- * @returns {PseudoHTMLCollection}
138
- */
139
- get children(): PseudoHTMLCollection;
140
- /**
141
- * How many element children this element has.
142
- * @returns {number}
143
- */
144
- get childElementCount(): number;
145
- /**
146
- * The first child of this element which is an element, or null when there is none.
147
- * @returns {PseudoElement|null}
148
- */
149
- get firstElementChild(): PseudoElement | null;
150
- /**
151
- * The last child of this element which is an element, or null when there is none.
152
- * @returns {PseudoElement|null}
153
- */
154
- get lastElementChild(): PseudoElement | null;
155
- /**
156
- * The sibling after this one which is an element, or null when there is none.
157
- * @returns {PseudoElement|null}
158
- */
159
- get nextElementSibling(): PseudoElement | null;
160
- /**
161
- * The sibling before this one which is an element, or null when there is none.
162
- * @returns {PseudoElement|null}
163
- */
164
- get previousElementSibling(): PseudoElement | null;
165
- /**
166
- * Put an element at a position relative to this one: beforebegin (before this element, as its previous sibling),
167
- * afterbegin (as this element's first child), beforeend (as this element's last child) or afterend (after this
168
- * element, as its next sibling).
169
- * @param {string} position beforebegin, afterbegin, beforeend or afterend
170
- * @param {ElementService} element The element to insert
171
- * @returns {ElementService|null} The inserted element, or null when the position needed a parent this element does not have
172
- * @throws {Error} When the position is not one of the four above
173
- */
174
- insertAdjacentElement(position: string, element: PseudoElement): PseudoElement | null;
175
- /**
176
- * Put text at a position relative to this element, the same as insertAdjacentElement but the text becomes a text node.
177
- * @param {string} position beforebegin, afterbegin, beforeend or afterend
178
- * @param {string} text The text to insert
179
- * @throws {Error} When the position is not one of the four above
180
- */
181
- insertAdjacentText(position: string, text: string): void;
182
- /**
183
- * Shared implementation for insertAdjacentElement / insertAdjacentText.
184
- * @param {string} position beforebegin, afterbegin, beforeend or afterend
185
- * @param {PseudoNode|string} node The node (or text) to insert
186
- * @returns {PseudoNode|null} The inserted node, or null when the position needed a parent this element does not have
187
- * @throws {Error} When the position is not one of the four above
188
- */
189
- private insertAdjacent;
190
- /**
191
- * Not implemented yet (HTML parsing is out of scope for now).
192
- * @param {string} position beforebegin, afterbegin, beforeend or afterend
193
- * @param {string} text The markup which would be parsed
194
- * @throws {Error}
195
- */
196
- insertAdjacentHTML(position: string, text: string): void;
197
- /**
198
- * Whether this element itself (not its descendants) matches the given CSS selector.
199
- * @param {string} selectors A CSS selector
200
- * @returns {boolean}
201
- */
202
- matches(selectors: string): boolean;
203
- /**
204
- * The nearest ancestor of this element (starting with this element itself) which matches the CSS selector, or
205
- * null when none of them do.
206
- * @param {string} selectors A CSS selector
207
- * @returns {PseudoElement|null}
208
- */
209
- closest(selectors: string): PseudoElement | null;
210
- applyDefaultEvent(): Function;
211
- /**
212
- * An element which is added as a child gets its default events (for example a submit button submits its form).
213
- * @param {NodeService} child The node which was inserted
214
- */
215
- protected childInserted(child: NodeService): void;
216
- /**
217
- * Check whether the element has an attribute by that name.
218
- * @param {string} attributeName
219
- * @returns {boolean}
220
- */
221
- hasAttribute(attributeName: string): boolean;
222
- /**
223
- * Set the value of an attribute, adding the attribute if it did not exist.
224
- * @param {string} attributeName
225
- * @param {string} attributeValue
226
- * @returns {undefined}
227
- */
228
- setAttribute(attributeName: string, attributeValue: string): void;
229
- /**
230
- * Retrieve the value of an attribute.
231
- * @param {string} attributeName
232
- * @returns {string|null} The value, or null when there is no such attribute
233
- */
234
- getAttribute(attributeName: string): string | null;
235
- /**
236
- * Remove an attribute from the element.
237
- * @param {string} attributeName
238
- * @returns {undefined}
239
- */
240
- removeAttribute(attributeName: string): void;
241
- /**
242
- * The name of every attribute on the element, in the order they were set.
243
- * @returns {Array<string>}
244
- */
245
- getAttributeNames(): Array<string>;
246
- /**
247
- * Whether the element has any attributes at all.
248
- * @returns {boolean}
249
- */
250
- hasAttributes(): boolean;
251
- /**
252
- * Add the attribute (with an empty value) when it is not present, or remove it when it is - unless force says
253
- * which of those to do instead. Returns whether the attribute is present after the call.
254
- * @param {string} attributeName
255
- * @param {boolean} [force]
256
- * @returns {boolean}
257
- */
258
- toggleAttribute(attributeName: string, force?: boolean): boolean;
259
- /**
260
- * The size of the element and its position, settable directly - there is no layout engine here to compute it.
261
- * @returns {DOMRect}
262
- */
263
- getBoundingClientRect(): DOMRect;
264
- /**
265
- * The bounding rectangles for each line of text in the element, settable directly - there is no layout engine
266
- * here to compute it.
267
- * @returns {Array<DOMRect>}
268
- */
269
- getClientRects(): Array<DOMRect>;
270
- /**
271
- * The Animation objects currently active on the element, settable directly - there is no animation engine here.
272
- * @returns {Array<*>}
273
- */
274
- getAnimations(): Array<any>;
275
- /**
276
- * Whether the element is expected to be visible, settable directly - there is no rendering here to check it.
277
- * @returns {boolean}
278
- */
279
- checkVisibility(): boolean;
280
- /**
281
- * A read-only view of the element's own inline style declarations (there is no CSS cascade here, so this is not a
282
- * real computed style - just what the element's own style object holds).
283
- * @returns {{get: function(string): (string|undefined)}}
284
- */
285
- computedStyleMap(): {
286
- get: (property: string) => string | undefined;
287
- };
288
- /**
289
- * Whether this element currently has capture of the given pointer.
290
- * @param {number} pointerId
291
- * @returns {boolean}
292
- */
293
- hasPointerCapture(pointerId: number): boolean;
294
- /**
295
- * Give this element capture of the given pointer.
296
- * @param {number} pointerId
297
- * @returns {undefined}
298
- */
299
- setPointerCapture(pointerId: number): void;
300
- /**
301
- * Release this element's capture of the given pointer, if it had it.
302
- * @param {number} pointerId
303
- * @returns {undefined}
304
- */
305
- releasePointerCapture(pointerId: number): void;
306
- /**
307
- * Scroll to the given position (or, given an options object, the position(s) it has). There is no real scrollable
308
- * viewport here: this just sets scrollLeft / scrollTop.
309
- * @param {number|{left: number, top: number}} [x=0]
310
- * @param {number} [y=0]
311
- * @returns {undefined}
312
- */
313
- scroll(x?: number | {
314
- left?: number;
315
- top?: number;
316
- }, y?: number): void;
317
- /**
318
- * Scroll to the given position. An alias for scroll.
319
- * @param {number|{left: number, top: number}} [x=0]
320
- * @param {number} [y=0]
321
- * @returns {undefined}
322
- */
323
- scrollTo(x?: number | {
324
- left?: number;
325
- top?: number;
326
- }, y?: number): void;
327
- /**
328
- * Scroll by the given amount, relative to the current position.
329
- * @param {number|{left: number, top: number}} [x=0]
330
- * @param {number} [y=0]
331
- * @returns {undefined}
332
- */
333
- scrollBy(x?: number | {
334
- left?: number;
335
- top?: number;
336
- }, y?: number): void;
337
- /**
338
- * Scroll an ancestor until this element is in view. There is no real viewport here for that to mean anything, so
339
- * this does nothing (override it on an instance in a test which needs to observe the call).
340
- * @returns {undefined}
341
- */
342
- scrollIntoView(): void;
343
- /**
344
- * Asynchronously ask for the element to be shown fullscreen. There is no real fullscreen here, so this just
345
- * resolves, like a browser granting the request would.
346
- * @returns {Promise<void>}
347
- */
348
- requestFullscreen(): Promise<void>;
349
- /**
350
- * Asynchronously ask for the pointer to be locked to this element. There is no real pointer lock here, so this
351
- * just resolves, like a browser granting the request would.
352
- * @returns {Promise<void>}
353
- */
354
- requestPointerLock(): Promise<void>;
355
- /**
356
- * Attach a shadow tree to this element and return its ShadowRoot. Throws when it already hosts one.
357
- * @param {{mode: string}} options
358
- * @returns {PseudoShadowRoot}
359
- * @throws {Error}
360
- */
361
- attachShadow(options: {
362
- mode: string;
363
- }): PseudoShadowRoot;
364
- /**
365
- * This element's shadow root, when it has one attached in 'open' mode, or null (including when the mode is
366
- * 'closed' - it still exists, but is not reachable this way, like the DOM's).
367
- * @returns {PseudoShadowRoot|null}
368
- */
369
- get shadowRoot(): PseudoShadowRoot | null;
370
- }
371
- export {};
1
+ /**
2
+ * @file Substitute for the DOM Element Class.
3
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
4
+ * @version 1.0.0
5
+ */
6
+ import { PseudoNode } from '../interfaces/PseudoNode';
7
+ import { PseudoElement } from '../interfaces/PseudoElement';
8
+ import { NodeService } from './NodeService';
9
+ import { PseudoNamedNodeMap } from '../interfaces/PseudoNamedNodeMap';
10
+ import { PseudoDOMTokenList } from '../interfaces/PseudoDOMTokenList';
11
+ import { PseudoHTMLCollection } from '../interfaces/PseudoHTMLCollection';
12
+ import { PseudoShadowRoot } from '../interfaces/PseudoShadowRoot';
13
+ type attribute = {
14
+ name: string;
15
+ value: any;
16
+ };
17
+ type DOMRect = {
18
+ x: number;
19
+ y: number;
20
+ width: number;
21
+ height: number;
22
+ top: number;
23
+ right: number;
24
+ bottom: number;
25
+ left: number;
26
+ };
27
+ /**
28
+ * Simulate the behaviour of the Element Class when there is no DOM available.
29
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
30
+ * @class
31
+ * @augments PseudoNode
32
+ * @property {string} tagName
33
+ * @property {string} className
34
+ * @property {string} id
35
+ * @property {string} innerHtml
36
+ * @property {Array} attributes
37
+ * @property {function} hasAttribute
38
+ * @property {function} setAttribute
39
+ * @property {function} getAttribute
40
+ * @property {function} removeAttribute
41
+ */
42
+ export declare class ElementService extends NodeService implements Partial<PseudoElement> {
43
+ id: string;
44
+ type: string;
45
+ clientHeight: number;
46
+ clientLeft: number;
47
+ clientTop: number;
48
+ clientWidth: number;
49
+ scrollHeight: number;
50
+ scrollLeft: number;
51
+ scrollTop: number;
52
+ scrollWidth: number;
53
+ /** What getBoundingClientRect() returns - not really computed (there is no layout engine), set this directly. */
54
+ boundingClientRect: DOMRect;
55
+ /** What getClientRects() returns - set this directly. */
56
+ clientRects: Array<DOMRect>;
57
+ /** What getAnimations() returns - set this directly. */
58
+ animations: Array<any>;
59
+ /** What checkVisibility() returns - set this directly. */
60
+ isVisible: boolean;
61
+ private readonly tag;
62
+ private readonly attributeList;
63
+ private readonly propertyAttributes;
64
+ private readonly tokenList;
65
+ private readonly capturedPointers;
66
+ private shadowRootInstance;
67
+ private defaultEventApplied;
68
+ /**
69
+ * @param {Object} [settings={}]
70
+ * @param {string} [settings.tagName=''] The name of the tag this element represents
71
+ * @param {Array<{name: string, value: *}>} [settings.attributes=[]] The attributes (also assigned as properties) to start with
72
+ * @param {PseudoNode|null} [settings.parent=null] The node to add this element to as its last child
73
+ * @param {Array<PseudoNode>} [settings.children=[]] The nodes to start as children
74
+ * @constructor
75
+ */
76
+ constructor({ tagName, attributes, parent, children }?: {
77
+ tagName?: string;
78
+ attributes?: Array<attribute>;
79
+ parent?: PseudoNode | null;
80
+ children?: Array<any>;
81
+ });
82
+ /**
83
+ * The attributes with the values they have now: the ones which are also properties (className, id, style, ...) can
84
+ * have been changed through the property, which does not change the stored list.
85
+ * @returns {Array<{name: string, value: *}>}
86
+ */
87
+ private currentAttributes;
88
+ get nodeName(): string;
89
+ /**
90
+ * A copy of this element without its children: the same tag and attributes (the values which are objects, such as
91
+ * style, are copied too rather than shared), but not its parent or listeners.
92
+ * @returns {ElementService}
93
+ */
94
+ protected cloneShallow(): NodeService;
95
+ /**
96
+ * Elements are equal when they have the same tag and the same attributes (in any order), which is what isEqualNode
97
+ * checks before it compares the children.
98
+ * @param {NodeService} other The element to compare with
99
+ * @returns {boolean}
100
+ */
101
+ protected equalsShallow(other: NodeService): boolean;
102
+ get tagName(): string;
103
+ /**
104
+ * The local part of the element's qualified name. There is no real namespace parsing here, so this is always the
105
+ * same as tagName.
106
+ * @returns {string}
107
+ */
108
+ get localName(): string;
109
+ /**
110
+ * The element's namespace prefix, or null when it has none. There is no real namespace parsing here, so this is
111
+ * always null.
112
+ * @returns {string|null}
113
+ */
114
+ get prefix(): string | null;
115
+ /**
116
+ * The HTML markup of this element's children. Only the getter is here (the setter, which needs to build new
117
+ * elements from parsed HTML, is on HTMLElementService - see its class comment).
118
+ * @returns {string}
119
+ */
120
+ get innerHTML(): string;
121
+ /**
122
+ * The HTML markup of this element itself, including its children. Only the getter is here (see innerHTML).
123
+ * @returns {string}
124
+ */
125
+ get outerHTML(): string;
126
+ get nodeType(): number;
127
+ get attributes(): PseudoNamedNodeMap;
128
+ get classList(): PseudoDOMTokenList;
129
+ get className(): string;
130
+ set className(className: string);
131
+ /**
132
+ * Some elements have default behaviour, this registers it when the element is added.
133
+ * @returns {Function}
134
+ */
135
+ /**
136
+ * A live view of this element's element children (text, comments and the like are not included).
137
+ * @returns {PseudoHTMLCollection}
138
+ */
139
+ get children(): PseudoHTMLCollection;
140
+ /**
141
+ * How many element children this element has.
142
+ * @returns {number}
143
+ */
144
+ get childElementCount(): number;
145
+ /**
146
+ * The first child of this element which is an element, or null when there is none.
147
+ * @returns {PseudoElement|null}
148
+ */
149
+ get firstElementChild(): PseudoElement | null;
150
+ /**
151
+ * The last child of this element which is an element, or null when there is none.
152
+ * @returns {PseudoElement|null}
153
+ */
154
+ get lastElementChild(): PseudoElement | null;
155
+ /**
156
+ * The sibling after this one which is an element, or null when there is none.
157
+ * @returns {PseudoElement|null}
158
+ */
159
+ get nextElementSibling(): PseudoElement | null;
160
+ /**
161
+ * The sibling before this one which is an element, or null when there is none.
162
+ * @returns {PseudoElement|null}
163
+ */
164
+ get previousElementSibling(): PseudoElement | null;
165
+ /**
166
+ * Put an element at a position relative to this one: beforebegin (before this element, as its previous sibling),
167
+ * afterbegin (as this element's first child), beforeend (as this element's last child) or afterend (after this
168
+ * element, as its next sibling).
169
+ * @param {string} position beforebegin, afterbegin, beforeend or afterend
170
+ * @param {ElementService} element The element to insert
171
+ * @returns {ElementService|null} The inserted element, or null when the position needed a parent this element does not have
172
+ * @throws {Error} When the position is not one of the four above
173
+ */
174
+ insertAdjacentElement(position: string, element: PseudoElement): PseudoElement | null;
175
+ /**
176
+ * Put text at a position relative to this element, the same as insertAdjacentElement but the text becomes a text node.
177
+ * @param {string} position beforebegin, afterbegin, beforeend or afterend
178
+ * @param {string} text The text to insert
179
+ * @throws {Error} When the position is not one of the four above
180
+ */
181
+ insertAdjacentText(position: string, text: string): void;
182
+ /**
183
+ * Shared implementation for insertAdjacentElement / insertAdjacentText.
184
+ * @param {string} position beforebegin, afterbegin, beforeend or afterend
185
+ * @param {PseudoNode|string} node The node (or text) to insert
186
+ * @returns {PseudoNode|null} The inserted node, or null when the position needed a parent this element does not have
187
+ * @throws {Error} When the position is not one of the four above
188
+ */
189
+ private insertAdjacent;
190
+ /**
191
+ * Not implemented yet (HTML parsing is out of scope for now).
192
+ * @param {string} position beforebegin, afterbegin, beforeend or afterend
193
+ * @param {string} text The markup which would be parsed
194
+ * @throws {Error}
195
+ */
196
+ insertAdjacentHTML(position: string, text: string): void;
197
+ /**
198
+ * Whether this element itself (not its descendants) matches the given CSS selector.
199
+ * @param {string} selectors A CSS selector
200
+ * @returns {boolean}
201
+ */
202
+ matches(selectors: string): boolean;
203
+ /**
204
+ * The nearest ancestor of this element (starting with this element itself) which matches the CSS selector, or
205
+ * null when none of them do.
206
+ * @param {string} selectors A CSS selector
207
+ * @returns {PseudoElement|null}
208
+ */
209
+ closest(selectors: string): PseudoElement | null;
210
+ applyDefaultEvent(): Function;
211
+ /**
212
+ * An element which is added as a child gets its default events (for example a submit button submits its form).
213
+ * @param {NodeService} child The node which was inserted
214
+ */
215
+ protected childInserted(child: NodeService): void;
216
+ /**
217
+ * Check whether the element has an attribute by that name.
218
+ * @param {string} attributeName
219
+ * @returns {boolean}
220
+ */
221
+ hasAttribute(attributeName: string): boolean;
222
+ /**
223
+ * Set the value of an attribute, adding the attribute if it did not exist.
224
+ * @param {string} attributeName
225
+ * @param {string} attributeValue
226
+ * @returns {undefined}
227
+ */
228
+ setAttribute(attributeName: string, attributeValue: string): void;
229
+ /**
230
+ * Retrieve the value of an attribute.
231
+ * @param {string} attributeName
232
+ * @returns {string|null} The value, or null when there is no such attribute
233
+ */
234
+ getAttribute(attributeName: string): string | null;
235
+ /**
236
+ * Remove an attribute from the element.
237
+ * @param {string} attributeName
238
+ * @returns {undefined}
239
+ */
240
+ removeAttribute(attributeName: string): void;
241
+ /**
242
+ * The name of every attribute on the element, in the order they were set.
243
+ * @returns {Array<string>}
244
+ */
245
+ getAttributeNames(): Array<string>;
246
+ /**
247
+ * Whether the element has any attributes at all.
248
+ * @returns {boolean}
249
+ */
250
+ hasAttributes(): boolean;
251
+ /**
252
+ * Add the attribute (with an empty value) when it is not present, or remove it when it is - unless force says
253
+ * which of those to do instead. Returns whether the attribute is present after the call.
254
+ * @param {string} attributeName
255
+ * @param {boolean} [force]
256
+ * @returns {boolean}
257
+ */
258
+ toggleAttribute(attributeName: string, force?: boolean): boolean;
259
+ /**
260
+ * The size of the element and its position, settable directly - there is no layout engine here to compute it.
261
+ * @returns {DOMRect}
262
+ */
263
+ getBoundingClientRect(): DOMRect;
264
+ /**
265
+ * The bounding rectangles for each line of text in the element, settable directly - there is no layout engine
266
+ * here to compute it.
267
+ * @returns {Array<DOMRect>}
268
+ */
269
+ getClientRects(): Array<DOMRect>;
270
+ /**
271
+ * The Animation objects currently active on the element, settable directly - there is no animation engine here.
272
+ * @returns {Array<*>}
273
+ */
274
+ getAnimations(): Array<any>;
275
+ /**
276
+ * Whether the element is expected to be visible, settable directly - there is no rendering here to check it.
277
+ * @returns {boolean}
278
+ */
279
+ checkVisibility(): boolean;
280
+ /**
281
+ * A read-only view of the element's own inline style declarations (there is no CSS cascade here, so this is not a
282
+ * real computed style - just what the element's own style object holds).
283
+ * @returns {{get: function(string): (string|undefined)}}
284
+ */
285
+ computedStyleMap(): {
286
+ get: (property: string) => string | undefined;
287
+ };
288
+ /**
289
+ * Whether this element currently has capture of the given pointer.
290
+ * @param {number} pointerId
291
+ * @returns {boolean}
292
+ */
293
+ hasPointerCapture(pointerId: number): boolean;
294
+ /**
295
+ * Give this element capture of the given pointer.
296
+ * @param {number} pointerId
297
+ * @returns {undefined}
298
+ */
299
+ setPointerCapture(pointerId: number): void;
300
+ /**
301
+ * Release this element's capture of the given pointer, if it had it.
302
+ * @param {number} pointerId
303
+ * @returns {undefined}
304
+ */
305
+ releasePointerCapture(pointerId: number): void;
306
+ /**
307
+ * Scroll to the given position (or, given an options object, the position(s) it has). There is no real scrollable
308
+ * viewport here: this just sets scrollLeft / scrollTop.
309
+ * @param {number|{left: number, top: number}} [x=0]
310
+ * @param {number} [y=0]
311
+ * @returns {undefined}
312
+ */
313
+ scroll(x?: number | {
314
+ left?: number;
315
+ top?: number;
316
+ }, y?: number): void;
317
+ /**
318
+ * Scroll to the given position. An alias for scroll.
319
+ * @param {number|{left: number, top: number}} [x=0]
320
+ * @param {number} [y=0]
321
+ * @returns {undefined}
322
+ */
323
+ scrollTo(x?: number | {
324
+ left?: number;
325
+ top?: number;
326
+ }, y?: number): void;
327
+ /**
328
+ * Scroll by the given amount, relative to the current position.
329
+ * @param {number|{left: number, top: number}} [x=0]
330
+ * @param {number} [y=0]
331
+ * @returns {undefined}
332
+ */
333
+ scrollBy(x?: number | {
334
+ left?: number;
335
+ top?: number;
336
+ }, y?: number): void;
337
+ /**
338
+ * Scroll an ancestor until this element is in view. There is no real viewport here for that to mean anything, so
339
+ * this does nothing (override it on an instance in a test which needs to observe the call).
340
+ * @returns {undefined}
341
+ */
342
+ scrollIntoView(): void;
343
+ /**
344
+ * Asynchronously ask for the element to be shown fullscreen. There is no real fullscreen here, so this just
345
+ * resolves, like a browser granting the request would.
346
+ * @returns {Promise<void>}
347
+ */
348
+ requestFullscreen(): Promise<void>;
349
+ /**
350
+ * Asynchronously ask for the pointer to be locked to this element. There is no real pointer lock here, so this
351
+ * just resolves, like a browser granting the request would.
352
+ * @returns {Promise<void>}
353
+ */
354
+ requestPointerLock(): Promise<void>;
355
+ /**
356
+ * Attach a shadow tree to this element and return its ShadowRoot. Throws when it already hosts one.
357
+ * @param {{mode: string}} options
358
+ * @returns {PseudoShadowRoot}
359
+ * @throws {Error}
360
+ */
361
+ attachShadow(options: {
362
+ mode: string;
363
+ }): PseudoShadowRoot;
364
+ /**
365
+ * This element's shadow root, when it has one attached in 'open' mode, or null (including when the mode is
366
+ * 'closed' - it still exists, but is not reachable this way, like the DOM's).
367
+ * @returns {PseudoShadowRoot|null}
368
+ */
369
+ get shadowRoot(): PseudoShadowRoot | null;
370
+ }
371
+ export {};