happy-dom 7.1.1 → 7.3.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.
Potentially problematic release.
This version of happy-dom might be problematic. Click here for more details.
- package/lib/config/ElementTag.d.ts +4 -2
- package/lib/config/ElementTag.js +4 -2
- package/lib/config/ElementTag.js.map +1 -1
- package/lib/config/NonImplemenetedElementClasses.js +0 -3
- package/lib/config/NonImplemenetedElementClasses.js.map +1 -1
- package/lib/index.d.ts +11 -1
- package/lib/index.js +12 -2
- package/lib/index.js.map +1 -1
- package/lib/nodes/attr/Attr.d.ts +1 -0
- package/lib/nodes/attr/Attr.js +1 -0
- package/lib/nodes/attr/Attr.js.map +1 -1
- package/lib/nodes/document/Document.d.ts +9 -0
- package/lib/nodes/document/Document.js +21 -0
- package/lib/nodes/document/Document.js.map +1 -1
- package/lib/nodes/document/IDocument.d.ts +9 -0
- package/lib/nodes/element/Element.d.ts +1 -0
- package/lib/nodes/element/Element.js +1 -0
- package/lib/nodes/element/Element.js.map +1 -1
- package/lib/nodes/element/IElement.d.ts +1 -0
- package/lib/nodes/html-audio-element/HTMLAudioElement.d.ts +11 -0
- package/lib/nodes/html-audio-element/HTMLAudioElement.js +17 -0
- package/lib/nodes/html-audio-element/HTMLAudioElement.js.map +1 -0
- package/lib/nodes/html-audio-element/IHTMLAudioElement.d.ts +9 -0
- package/lib/nodes/html-audio-element/IHTMLAudioElement.js +3 -0
- package/lib/nodes/html-audio-element/IHTMLAudioElement.js.map +1 -0
- package/lib/nodes/html-media-element/HTMLMediaElement.d.ts +234 -0
- package/lib/nodes/html-media-element/HTMLMediaElement.js +418 -0
- package/lib/nodes/html-media-element/HTMLMediaElement.js.map +1 -0
- package/lib/nodes/html-media-element/IHTMLMediaElement.d.ts +76 -0
- package/lib/nodes/html-media-element/IHTMLMediaElement.js +3 -0
- package/lib/nodes/html-media-element/IHTMLMediaElement.js.map +1 -0
- package/lib/nodes/html-video-element/HTMLVideoElement.d.ts +11 -0
- package/lib/nodes/html-video-element/HTMLVideoElement.js +17 -0
- package/lib/nodes/html-video-element/HTMLVideoElement.js.map +1 -0
- package/lib/nodes/html-video-element/IHTMLVideoElement.d.ts +9 -0
- package/lib/nodes/html-video-element/IHTMLVideoElement.js +3 -0
- package/lib/nodes/html-video-element/IHTMLVideoElement.js.map +1 -0
- package/lib/nodes/node/INode.d.ts +8 -0
- package/lib/nodes/node/Node.d.ts +20 -0
- package/lib/nodes/node/Node.js +154 -0
- package/lib/nodes/node/Node.js.map +1 -1
- package/lib/nodes/node/NodeDocumentPositionEnum.d.ts +9 -0
- package/lib/nodes/node/NodeDocumentPositionEnum.js +13 -0
- package/lib/nodes/node/NodeDocumentPositionEnum.js.map +1 -0
- package/lib/nodes/node/NodeUtility.d.ts +16 -0
- package/lib/nodes/node/NodeUtility.js +100 -0
- package/lib/nodes/node/NodeUtility.js.map +1 -1
- package/lib/nodes/processing-instruction/IProcessingInstruction.d.ts +4 -0
- package/lib/nodes/processing-instruction/IProcessingInstruction.js +3 -0
- package/lib/nodes/processing-instruction/IProcessingInstruction.js.map +1 -0
- package/lib/nodes/processing-instruction/ProcessingInstruction.d.ts +12 -0
- package/lib/nodes/processing-instruction/ProcessingInstruction.js +20 -0
- package/lib/nodes/processing-instruction/ProcessingInstruction.js.map +1 -0
- package/lib/window/IWindow.d.ts +8 -0
- package/lib/window/Window.d.ts +8 -0
- package/lib/window/Window.js +8 -0
- package/lib/window/Window.js.map +1 -1
- package/package.json +2 -2
- package/src/config/ElementTag.ts +4 -2
- package/src/config/NonImplemenetedElementClasses.ts +0 -3
- package/src/index.ts +21 -1
- package/src/nodes/attr/Attr.ts +1 -0
- package/src/nodes/document/Document.ts +28 -0
- package/src/nodes/document/IDocument.ts +10 -0
- package/src/nodes/element/Element.ts +1 -0
- package/src/nodes/element/IElement.ts +1 -0
- package/src/nodes/html-audio-element/HTMLAudioElement.ts +11 -0
- package/src/nodes/html-audio-element/IHTMLAudioElement.ts +11 -0
- package/src/nodes/html-media-element/HTMLMediaElement.ts +441 -0
- package/src/nodes/html-media-element/IHTMLMediaElement.ts +84 -0
- package/src/nodes/html-video-element/HTMLVideoElement.ts +11 -0
- package/src/nodes/html-video-element/IHTMLVideoElement.ts +11 -0
- package/src/nodes/node/INode.ts +8 -0
- package/src/nodes/node/Node.ts +191 -1
- package/src/nodes/node/NodeDocumentPositionEnum.ts +10 -0
- package/src/nodes/node/NodeUtility.ts +137 -0
- package/src/nodes/processing-instruction/IProcessingInstruction.ts +5 -0
- package/src/nodes/processing-instruction/ProcessingInstruction.ts +13 -0
- package/src/window/IWindow.ts +8 -0
- package/src/window/Window.ts +8 -0
@@ -0,0 +1,441 @@
|
|
1
|
+
import ErrorEvent from 'src/event/events/ErrorEvent';
|
2
|
+
import Event from '../../event/Event';
|
3
|
+
import DOMException from '../../exception/DOMException';
|
4
|
+
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum';
|
5
|
+
import HTMLElement from '../html-element/HTMLElement';
|
6
|
+
import IHTMLMediaElement, { IMediaError } from './IHTMLMediaElement';
|
7
|
+
|
8
|
+
/**
|
9
|
+
*
|
10
|
+
* This implementation coming from jsdom
|
11
|
+
* https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/nodes/HTMLMediaElement-impl.js#L7
|
12
|
+
*
|
13
|
+
*/
|
14
|
+
function getTimeRangeDummy(): object {
|
15
|
+
return {
|
16
|
+
length: 0,
|
17
|
+
start() {
|
18
|
+
return 0;
|
19
|
+
},
|
20
|
+
end() {
|
21
|
+
return 0;
|
22
|
+
}
|
23
|
+
};
|
24
|
+
}
|
25
|
+
/**
|
26
|
+
* HTML Media Element.
|
27
|
+
*
|
28
|
+
* Reference:
|
29
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement.
|
30
|
+
*
|
31
|
+
*/
|
32
|
+
export default class HTMLMediaElement extends HTMLElement implements IHTMLMediaElement {
|
33
|
+
// Public Properties
|
34
|
+
public readonly buffered = getTimeRangeDummy();
|
35
|
+
public readonly duration = NaN;
|
36
|
+
public readonly error: IMediaError = null;
|
37
|
+
public readonly ended = false;
|
38
|
+
public readonly networkState = 0;
|
39
|
+
public readonly readyState = 0;
|
40
|
+
public readonly textTracks = [];
|
41
|
+
public readonly videoTracks = [];
|
42
|
+
public readonly seeking = false;
|
43
|
+
public readonly seekable = getTimeRangeDummy();
|
44
|
+
public readonly played = getTimeRangeDummy();
|
45
|
+
|
46
|
+
// Events
|
47
|
+
public onabort: (event: Event) => void = null;
|
48
|
+
public oncanplay: (event: Event) => void = null;
|
49
|
+
public oncanplaythrough: (event: Event) => void = null;
|
50
|
+
public ondurationchange: (event: Event) => void = null;
|
51
|
+
public onemptied: (event: Event) => void = null;
|
52
|
+
public onended: (event: Event) => void = null;
|
53
|
+
public onerror: (event: ErrorEvent) => void = null;
|
54
|
+
public onloadeddata: (event: Event) => void = null;
|
55
|
+
|
56
|
+
#volume = 1;
|
57
|
+
#paused = true;
|
58
|
+
#currentTime = 0;
|
59
|
+
#playbackRate = 1;
|
60
|
+
#defaultPlaybackRate = 1;
|
61
|
+
#muted = false;
|
62
|
+
#defaultMuted = false;
|
63
|
+
#preservesPitch = true;
|
64
|
+
/**
|
65
|
+
* Returns autoplay.
|
66
|
+
*
|
67
|
+
* @returns Autoplay.
|
68
|
+
*/
|
69
|
+
public get autoplay(): boolean {
|
70
|
+
return this.getAttributeNS(null, 'autoplay') !== null;
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Sets autoplay.
|
75
|
+
*
|
76
|
+
* @param autoplay Autoplay.
|
77
|
+
*/
|
78
|
+
public set autoplay(autoplay: boolean) {
|
79
|
+
if (!autoplay) {
|
80
|
+
this.removeAttributeNS(null, 'autoplay');
|
81
|
+
} else {
|
82
|
+
this.setAttributeNS(null, 'autoplay', '');
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Returns controls.
|
88
|
+
*
|
89
|
+
* @returns Controls.
|
90
|
+
*/
|
91
|
+
public get controls(): boolean {
|
92
|
+
return this.getAttributeNS(null, 'controls') !== null;
|
93
|
+
}
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Sets controls.
|
97
|
+
*
|
98
|
+
* @param controls Controls.
|
99
|
+
*/
|
100
|
+
public set controls(controls: boolean) {
|
101
|
+
if (!controls) {
|
102
|
+
this.removeAttributeNS(null, 'controls');
|
103
|
+
} else {
|
104
|
+
this.setAttributeNS(null, 'controls', '');
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Returns loop.
|
110
|
+
*
|
111
|
+
* @returns Loop.
|
112
|
+
*/
|
113
|
+
public get loop(): boolean {
|
114
|
+
return this.getAttributeNS(null, 'loop') !== null;
|
115
|
+
}
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Sets loop.
|
119
|
+
*
|
120
|
+
* @param loop Loop.
|
121
|
+
*/
|
122
|
+
public set loop(loop: boolean) {
|
123
|
+
if (!loop) {
|
124
|
+
this.removeAttributeNS(null, 'loop');
|
125
|
+
} else {
|
126
|
+
this.setAttributeNS(null, 'loop', '');
|
127
|
+
}
|
128
|
+
}
|
129
|
+
/**
|
130
|
+
* Returns muted.
|
131
|
+
*
|
132
|
+
* @returns Muted.
|
133
|
+
*/
|
134
|
+
public get muted(): boolean {
|
135
|
+
if (this.#muted) {
|
136
|
+
return this.#muted;
|
137
|
+
}
|
138
|
+
|
139
|
+
if (!this.#defaultMuted) {
|
140
|
+
return this.getAttributeNS(null, 'muted') !== null;
|
141
|
+
}
|
142
|
+
|
143
|
+
return false;
|
144
|
+
}
|
145
|
+
|
146
|
+
/**
|
147
|
+
* Sets muted.
|
148
|
+
*
|
149
|
+
* @param muted Muted.
|
150
|
+
*/
|
151
|
+
public set muted(muted: boolean) {
|
152
|
+
this.#muted = !!muted;
|
153
|
+
if (!muted && !this.#defaultMuted) {
|
154
|
+
this.removeAttributeNS(null, 'muted');
|
155
|
+
} else {
|
156
|
+
this.setAttributeNS(null, 'muted', '');
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
/**
|
161
|
+
* Returns defaultMuted.
|
162
|
+
*
|
163
|
+
* @returns DefaultMuted.
|
164
|
+
*/
|
165
|
+
public get defaultMuted(): boolean {
|
166
|
+
return this.#defaultMuted;
|
167
|
+
}
|
168
|
+
|
169
|
+
/**
|
170
|
+
* Sets defaultMuted.
|
171
|
+
*
|
172
|
+
* @param defaultMuted DefaultMuted.
|
173
|
+
*/
|
174
|
+
public set defaultMuted(defaultMuted: boolean) {
|
175
|
+
this.#defaultMuted = !!defaultMuted;
|
176
|
+
if (!this.#defaultMuted && !this.#muted) {
|
177
|
+
this.removeAttributeNS(null, 'muted');
|
178
|
+
} else {
|
179
|
+
this.setAttributeNS(null, 'muted', '');
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
/**
|
184
|
+
* Returns src.
|
185
|
+
*
|
186
|
+
* @returns Src.
|
187
|
+
*/
|
188
|
+
public get src(): string {
|
189
|
+
return this.getAttributeNS(null, 'src') || '';
|
190
|
+
}
|
191
|
+
|
192
|
+
/**
|
193
|
+
* Sets src.
|
194
|
+
*
|
195
|
+
* @param src Src.
|
196
|
+
*/
|
197
|
+
public set src(src: string) {
|
198
|
+
this.setAttributeNS(null, 'src', src);
|
199
|
+
if (Boolean(src)) {
|
200
|
+
this.dispatchEvent(new Event('canplay', { bubbles: false, cancelable: false }));
|
201
|
+
this.dispatchEvent(new Event('durationchange', { bubbles: false, cancelable: false }));
|
202
|
+
}
|
203
|
+
}
|
204
|
+
|
205
|
+
/**
|
206
|
+
* Returns currentSrc.
|
207
|
+
*
|
208
|
+
* @returns CurrentrSrc.
|
209
|
+
*/
|
210
|
+
public get currentSrc(): string {
|
211
|
+
return this.src;
|
212
|
+
}
|
213
|
+
|
214
|
+
/**
|
215
|
+
* Returns volume.
|
216
|
+
*
|
217
|
+
* @returns Volume.
|
218
|
+
*/
|
219
|
+
public get volume(): number {
|
220
|
+
return this.#volume;
|
221
|
+
}
|
222
|
+
|
223
|
+
/**
|
224
|
+
* Sets volume.
|
225
|
+
*
|
226
|
+
* @param volume Volume.
|
227
|
+
*/
|
228
|
+
public set volume(volume: number | string) {
|
229
|
+
const parsedVolume = Number(volume);
|
230
|
+
|
231
|
+
if (isNaN(parsedVolume)) {
|
232
|
+
throw new TypeError(
|
233
|
+
`Failed to set the 'volume' property on 'HTMLMediaElement': The provided double value is non-finite.`
|
234
|
+
);
|
235
|
+
}
|
236
|
+
if (parsedVolume < 0 || parsedVolume > 1) {
|
237
|
+
throw new DOMException(
|
238
|
+
`Failed to set the 'volume' property on 'HTMLMediaElement': The volume provided (${parsedVolume}) is outside the range [0, 1].`,
|
239
|
+
DOMExceptionNameEnum.indexSizeError
|
240
|
+
);
|
241
|
+
}
|
242
|
+
// TODO: volumechange event https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/volumechange_event
|
243
|
+
this.#volume = parsedVolume;
|
244
|
+
}
|
245
|
+
|
246
|
+
/**
|
247
|
+
* Returns crossOrigin.
|
248
|
+
*
|
249
|
+
* @returns CrossOrigin.
|
250
|
+
*/
|
251
|
+
public get crossOrigin(): string {
|
252
|
+
return this.getAttributeNS(null, 'crossorigin');
|
253
|
+
}
|
254
|
+
|
255
|
+
/**
|
256
|
+
* Sets crossOrigin.
|
257
|
+
*
|
258
|
+
* @param crossOrigin CrossOrigin.
|
259
|
+
*/
|
260
|
+
public set crossOrigin(crossOrigin: string | null) {
|
261
|
+
if (crossOrigin === null) {
|
262
|
+
return;
|
263
|
+
}
|
264
|
+
|
265
|
+
if (['', 'use-credentials', 'anonymous'].includes(crossOrigin)) {
|
266
|
+
this.setAttributeNS(null, 'crossorigin', crossOrigin);
|
267
|
+
} else {
|
268
|
+
this.setAttributeNS(null, 'crossorigin', 'anonymous');
|
269
|
+
}
|
270
|
+
}
|
271
|
+
|
272
|
+
/**
|
273
|
+
* Returns currentTime.
|
274
|
+
*
|
275
|
+
* @returns CurrentTime.
|
276
|
+
*/
|
277
|
+
public get currentTime(): number {
|
278
|
+
return this.#currentTime;
|
279
|
+
}
|
280
|
+
|
281
|
+
/**
|
282
|
+
* Sets currentTime.
|
283
|
+
*
|
284
|
+
* @param currentTime CurrentTime.
|
285
|
+
*/
|
286
|
+
public set currentTime(currentTime: number | string) {
|
287
|
+
const parsedCurrentTime = Number(currentTime);
|
288
|
+
if (isNaN(parsedCurrentTime)) {
|
289
|
+
throw new TypeError(
|
290
|
+
`Failed to set the 'currentTime' property on 'HTMLMediaElement': The provided double value is non-finite.`
|
291
|
+
);
|
292
|
+
}
|
293
|
+
this.#currentTime = parsedCurrentTime;
|
294
|
+
}
|
295
|
+
|
296
|
+
/**
|
297
|
+
* Returns playbackRate.
|
298
|
+
*
|
299
|
+
* @returns PlaybackRate.
|
300
|
+
*/
|
301
|
+
public get playbackRate(): number {
|
302
|
+
return this.#playbackRate;
|
303
|
+
}
|
304
|
+
|
305
|
+
/**
|
306
|
+
* Sets playbackRate.
|
307
|
+
*
|
308
|
+
* @param playbackRate PlaybackRate.
|
309
|
+
*/
|
310
|
+
public set playbackRate(playbackRate: number | string) {
|
311
|
+
const parsedPlaybackRate = Number(playbackRate);
|
312
|
+
if (isNaN(parsedPlaybackRate)) {
|
313
|
+
throw new TypeError(
|
314
|
+
`Failed to set the 'playbackRate' property on 'HTMLMediaElement': The provided double value is non-finite.`
|
315
|
+
);
|
316
|
+
}
|
317
|
+
this.#playbackRate = parsedPlaybackRate;
|
318
|
+
}
|
319
|
+
|
320
|
+
/**
|
321
|
+
* Returns defaultPlaybackRate.
|
322
|
+
*
|
323
|
+
* @returns DefaultPlaybackRate.
|
324
|
+
*/
|
325
|
+
public get defaultPlaybackRate(): number {
|
326
|
+
return this.#defaultPlaybackRate;
|
327
|
+
}
|
328
|
+
|
329
|
+
/**
|
330
|
+
* Sets defaultPlaybackRate.
|
331
|
+
*
|
332
|
+
* @param defaultPlaybackRate DefaultPlaybackRate.
|
333
|
+
*/
|
334
|
+
public set defaultPlaybackRate(defaultPlaybackRate: number | string) {
|
335
|
+
const parsedDefaultPlaybackRate = Number(defaultPlaybackRate);
|
336
|
+
if (isNaN(parsedDefaultPlaybackRate)) {
|
337
|
+
throw new TypeError(
|
338
|
+
`Failed to set the 'defaultPlaybackRate' property on 'HTMLMediaElement': The provided double value is non-finite.`
|
339
|
+
);
|
340
|
+
}
|
341
|
+
this.#defaultPlaybackRate = parsedDefaultPlaybackRate;
|
342
|
+
}
|
343
|
+
|
344
|
+
/**
|
345
|
+
* Returns preservesPitch.
|
346
|
+
*
|
347
|
+
* @returns PlaybackRate.
|
348
|
+
*/
|
349
|
+
public get preservesPitch(): boolean {
|
350
|
+
return this.#preservesPitch;
|
351
|
+
}
|
352
|
+
|
353
|
+
/**
|
354
|
+
* Sets preservesPitch.
|
355
|
+
*
|
356
|
+
* @param preservesPitch PreservesPitch.
|
357
|
+
*/
|
358
|
+
public set preservesPitch(preservesPitch: boolean) {
|
359
|
+
this.#preservesPitch = Boolean(preservesPitch);
|
360
|
+
}
|
361
|
+
|
362
|
+
/**
|
363
|
+
* Returns preload.
|
364
|
+
*
|
365
|
+
* @returns preload.
|
366
|
+
*/
|
367
|
+
public get preload(): string {
|
368
|
+
return this.getAttributeNS(null, 'preload') || 'auto';
|
369
|
+
}
|
370
|
+
|
371
|
+
/**
|
372
|
+
* Sets preload.
|
373
|
+
*
|
374
|
+
* @param preload preload.
|
375
|
+
*/
|
376
|
+
public set preload(preload: string) {
|
377
|
+
this.setAttributeNS(null, 'preload', preload);
|
378
|
+
}
|
379
|
+
|
380
|
+
/**
|
381
|
+
* Returns paused.
|
382
|
+
*
|
383
|
+
* @returns Paused.
|
384
|
+
*/
|
385
|
+
public get paused(): boolean {
|
386
|
+
return this.#paused;
|
387
|
+
}
|
388
|
+
|
389
|
+
/**
|
390
|
+
* Pause played media.
|
391
|
+
*/
|
392
|
+
public pause(): void {
|
393
|
+
this.#paused = true;
|
394
|
+
this.dispatchEvent(new Event('pause', { bubbles: false, cancelable: false }));
|
395
|
+
}
|
396
|
+
|
397
|
+
/**
|
398
|
+
* Start playing media.
|
399
|
+
*/
|
400
|
+
public async play(): Promise<void> {
|
401
|
+
this.#paused = false;
|
402
|
+
return Promise.resolve();
|
403
|
+
}
|
404
|
+
|
405
|
+
/**
|
406
|
+
*
|
407
|
+
* @param _type
|
408
|
+
*/
|
409
|
+
public canPlayType(_type: string): string {
|
410
|
+
return '';
|
411
|
+
}
|
412
|
+
|
413
|
+
/**
|
414
|
+
* Load media.
|
415
|
+
*/
|
416
|
+
public load(): void {
|
417
|
+
this.dispatchEvent(new Event('emptied', { bubbles: false, cancelable: false }));
|
418
|
+
}
|
419
|
+
|
420
|
+
/**
|
421
|
+
*
|
422
|
+
*/
|
423
|
+
public captureStream(): object {
|
424
|
+
return {};
|
425
|
+
}
|
426
|
+
|
427
|
+
/**
|
428
|
+
* Clones a node.
|
429
|
+
*
|
430
|
+
* @override
|
431
|
+
* @param [deep=false] "true" to clone deep.
|
432
|
+
* @returns Cloned node.
|
433
|
+
*/
|
434
|
+
/**
|
435
|
+
*
|
436
|
+
* @param deep
|
437
|
+
*/
|
438
|
+
public cloneNode(deep = false): IHTMLMediaElement {
|
439
|
+
return <IHTMLMediaElement>super.cloneNode(deep);
|
440
|
+
}
|
441
|
+
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
import IHTMLElement from '../html-element/IHTMLElement';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* HTML Media Element.
|
5
|
+
*
|
6
|
+
* Reference:
|
7
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement.
|
8
|
+
*/
|
9
|
+
|
10
|
+
export interface IMediaError {
|
11
|
+
code: number;
|
12
|
+
message: string;
|
13
|
+
}
|
14
|
+
export default interface IHTMLMediaElement extends IHTMLElement {
|
15
|
+
readonly currentSrc: string;
|
16
|
+
readonly duration: number;
|
17
|
+
readonly ended: boolean;
|
18
|
+
readonly error: IMediaError | null;
|
19
|
+
readonly networkState: number;
|
20
|
+
readonly played: object; // TimeRanges https://developer.mozilla.org/en-US/docs/Web/API/TimeRanges
|
21
|
+
readonly readyState: number;
|
22
|
+
readonly seekable: object; // TimeRanges https://developer.mozilla.org/en-US/docs/Web/API/TimeRanges
|
23
|
+
readonly seeking: boolean;
|
24
|
+
readonly textTracks: object[];
|
25
|
+
readonly videoTracks: object[];
|
26
|
+
readonly buffered: object; // TimeRanges https://developer.mozilla.org/en-US/docs/Web/API/TimeRanges
|
27
|
+
autoplay: boolean;
|
28
|
+
controls: boolean;
|
29
|
+
crossOrigin: string; // Only anonymus and 'use-credentials' is valid
|
30
|
+
currentTime: number | string;
|
31
|
+
defaultMuted: boolean;
|
32
|
+
defaultPlaybackRate: number | string;
|
33
|
+
loop: boolean;
|
34
|
+
muted: boolean;
|
35
|
+
paused: boolean;
|
36
|
+
playbackRate: number | string;
|
37
|
+
preload: string;
|
38
|
+
preservesPitch: boolean;
|
39
|
+
src: string;
|
40
|
+
volume: number | string;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* A MediaStream object which can be used as a source for audio and/or video data by other media processing code,
|
44
|
+
* or as a source for WebRTC.
|
45
|
+
* Https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/captureStream
|
46
|
+
*/
|
47
|
+
captureStream(): object;
|
48
|
+
|
49
|
+
/**
|
50
|
+
* The HTMLMediaElement method canPlayType() reports how likely it is that the current browser will be able to play
|
51
|
+
* media of a given MIME type.
|
52
|
+
* Https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/canPlayType
|
53
|
+
* possible return value: "" | "probably" | "maybe".
|
54
|
+
*/
|
55
|
+
canPlayType(_type: string): string;
|
56
|
+
|
57
|
+
/**
|
58
|
+
* The HTMLMediaElement method load() resets the media element to its initial state and begins the process of
|
59
|
+
* selecting a media source and loading the media in preparation for playback to begin at the beginning.
|
60
|
+
* Https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/load.
|
61
|
+
*/
|
62
|
+
load(): void;
|
63
|
+
|
64
|
+
/**
|
65
|
+
* The HTMLMediaElement.pause() method will pause playback of the media, if the media is already in a paused state
|
66
|
+
* this method will have no effect.
|
67
|
+
*/
|
68
|
+
pause(): void;
|
69
|
+
|
70
|
+
/**
|
71
|
+
* The HTMLMediaElement play() method attempts to begin playback of the media. It returns a Promise
|
72
|
+
* which is resolved when playback has been successfully started.
|
73
|
+
*/
|
74
|
+
play(): Promise<void>;
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Clones a node.
|
78
|
+
*
|
79
|
+
* @override
|
80
|
+
* @param [deep=false] "true" to clone deep.
|
81
|
+
* @returns Cloned node.
|
82
|
+
*/
|
83
|
+
cloneNode(deep: boolean): IHTMLMediaElement;
|
84
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import HTMLMediaElement from '../html-media-element/HTMLMediaElement';
|
2
|
+
import IHTMLVideoElement from './IHTMLVideoElement';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* HTML Video Element.
|
6
|
+
*
|
7
|
+
* Reference:
|
8
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement.
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
export default class HTMLVideoElement extends HTMLMediaElement implements IHTMLVideoElement {}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import IHTMLMediaElement from '../html-media-element/IHTMLMediaElement';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* HTML Video Element.
|
5
|
+
*
|
6
|
+
* Reference:
|
7
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement.
|
8
|
+
*/
|
9
|
+
|
10
|
+
type IHTMLVideoElement = IHTMLMediaElement;
|
11
|
+
export default IHTMLVideoElement;
|
package/src/nodes/node/INode.ts
CHANGED
@@ -3,6 +3,7 @@ import IDocument from '../document/IDocument';
|
|
3
3
|
import IElement from '../element/IElement';
|
4
4
|
import INodeList from './INodeList';
|
5
5
|
import NodeTypeEnum from './NodeTypeEnum';
|
6
|
+
import NodeDocumentPositionEnum from './NodeDocumentPositionEnum';
|
6
7
|
|
7
8
|
export default interface INode extends IEventTarget {
|
8
9
|
readonly ELEMENT_NODE: NodeTypeEnum;
|
@@ -14,6 +15,12 @@ export default interface INode extends IEventTarget {
|
|
14
15
|
readonly DOCUMENT_TYPE_NODE: NodeTypeEnum;
|
15
16
|
readonly DOCUMENT_FRAGMENT_NODE: NodeTypeEnum;
|
16
17
|
readonly PROCESSING_INSTRUCTION_NODE: NodeTypeEnum;
|
18
|
+
readonly DOCUMENT_POSITION_DISCONNECTED: NodeDocumentPositionEnum;
|
19
|
+
readonly DOCUMENT_POSITION_PRECEDING: NodeDocumentPositionEnum;
|
20
|
+
readonly DOCUMENT_POSITION_FOLLOWING: NodeDocumentPositionEnum;
|
21
|
+
readonly DOCUMENT_POSITION_CONTAINS: NodeDocumentPositionEnum;
|
22
|
+
readonly DOCUMENT_POSITION_CONTAINED_BY: NodeDocumentPositionEnum;
|
23
|
+
readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: NodeDocumentPositionEnum;
|
17
24
|
readonly ownerDocument: IDocument;
|
18
25
|
readonly parentNode: INode;
|
19
26
|
readonly parentElement: IElement;
|
@@ -39,4 +46,5 @@ export default interface INode extends IEventTarget {
|
|
39
46
|
insertBefore(newNode: INode, referenceNode?: INode | null): INode;
|
40
47
|
replaceChild(newChild: INode, oldChild: INode): INode;
|
41
48
|
toString(): string;
|
49
|
+
compareDocumentPosition(otherNode: INode): number;
|
42
50
|
}
|