main
js 3,679 lines 110 KB
Raw
1 // flow-typed signature: 2872ddd56ba4b4bfefacac38ebdc6087
2 // flow-typed version: 3e51657e95/dom/flow_>=v0.261.x
3
4 /* Files */
5
6 declare class Blob {
7 constructor(
8 blobParts?: Array<any>,
9 options?: {
10 type?: string,
11 endings?: string,
12 ...
13 }
14 ): void;
15 isClosed: boolean;
16 size: number;
17 type: string;
18 close(): void;
19 slice(start?: number, end?: number, contentType?: string): Blob;
20 arrayBuffer(): Promise<ArrayBuffer>;
21 text(): Promise<string>;
22 stream(): ReadableStream;
23 }
24
25 declare class FileReader extends EventTarget {
26 +EMPTY: 0;
27 +LOADING: 1;
28 +DONE: 2;
29 +error: null | DOMError;
30 +readyState: 0 | 1 | 2;
31 +result: null | string | ArrayBuffer;
32 abort(): void;
33 onabort: null | ((ev: ProgressEvent) => any);
34 onerror: null | ((ev: ProgressEvent) => any);
35 onload: null | ((ev: ProgressEvent) => any);
36 onloadend: null | ((ev: ProgressEvent) => any);
37 onloadstart: null | ((ev: ProgressEvent) => any);
38 onprogress: null | ((ev: ProgressEvent) => any);
39 readAsArrayBuffer(blob: Blob): void;
40 readAsBinaryString(blob: Blob): void;
41 readAsDataURL(blob: Blob): void;
42 readAsText(blob: Blob, encoding?: string): void;
43 }
44
45 declare type FilePropertyBag = {
46 type?: string,
47 lastModified?: number,
48 ...
49 };
50 declare class File extends Blob {
51 constructor(
52 fileBits: $ReadOnlyArray<string | BufferDataSource | Blob>,
53 filename: string,
54 options?: FilePropertyBag
55 ): void;
56 lastModified: number;
57 name: string;
58 }
59
60 declare class FileList {
61 @@iterator(): Iterator<File>;
62 length: number;
63 item(index: number): File;
64 [index: number]: File;
65 }
66
67 declare class DOMError {
68 name: string;
69 }
70
71 declare interface ShadowRoot extends DocumentFragment {
72 +delegatesFocus: boolean;
73 +host: Element;
74 // flowlint unsafe-getters-setters:off
75 get innerHTML(): string;
76 set innerHTML(value: string | TrustedHTML): void;
77 // flowlint unsafe-getters-setters:error
78 +mode: ShadowRootMode;
79
80 // From DocumentOrShadowRoot Mixin.
81 +styleSheets: StyleSheetList;
82 adoptedStyleSheets: Array<CSSStyleSheet>;
83 }
84
85 declare type ShadowRootMode = 'open' | 'closed';
86
87 declare type ShadowRootInit = {
88 delegatesFocus?: boolean,
89 mode: ShadowRootMode,
90 ...
91 };
92
93 declare type ScrollToOptions = {
94 top?: number,
95 left?: number,
96 behavior?: 'auto' | 'smooth',
97 ...
98 };
99
100 type EventHandler = (event: Event) => mixed;
101 type EventListener = {handleEvent: EventHandler, ...} | EventHandler;
102 type MouseEventHandler = (event: MouseEvent) => mixed;
103 type MouseEventListener =
104 | {handleEvent: MouseEventHandler, ...}
105 | MouseEventHandler;
106 type FocusEventHandler = (event: FocusEvent) => mixed;
107 type FocusEventListener =
108 | {handleEvent: FocusEventHandler, ...}
109 | FocusEventHandler;
110 type KeyboardEventHandler = (event: KeyboardEvent) => mixed;
111 type KeyboardEventListener =
112 | {handleEvent: KeyboardEventHandler, ...}
113 | KeyboardEventHandler;
114 type InputEventHandler = (event: InputEvent) => mixed;
115 type InputEventListener =
116 | {handleEvent: InputEventHandler, ...}
117 | InputEventHandler;
118 type TouchEventHandler = (event: TouchEvent) => mixed;
119 type TouchEventListener =
120 | {handleEvent: TouchEventHandler, ...}
121 | TouchEventHandler;
122 type WheelEventHandler = (event: WheelEvent) => mixed;
123 type WheelEventListener =
124 | {handleEvent: WheelEventHandler, ...}
125 | WheelEventHandler;
126 type AbortProgressEventHandler = (event: ProgressEvent) => mixed;
127 type AbortProgressEventListener =
128 | {handleEvent: AbortProgressEventHandler, ...}
129 | AbortProgressEventHandler;
130 type ProgressEventHandler = (event: ProgressEvent) => mixed;
131 type ProgressEventListener =
132 | {handleEvent: ProgressEventHandler, ...}
133 | ProgressEventHandler;
134 type DragEventHandler = (event: DragEvent) => mixed;
135 type DragEventListener =
136 | {handleEvent: DragEventHandler, ...}
137 | DragEventHandler;
138 type PointerEventHandler = (event: PointerEvent) => mixed;
139 type PointerEventListener =
140 | {handleEvent: PointerEventHandler, ...}
141 | PointerEventHandler;
142 type AnimationEventHandler = (event: AnimationEvent) => mixed;
143 type AnimationEventListener =
144 | {handleEvent: AnimationEventHandler, ...}
145 | AnimationEventHandler;
146 type ClipboardEventHandler = (event: ClipboardEvent) => mixed;
147 type ClipboardEventListener =
148 | {handleEvent: ClipboardEventHandler, ...}
149 | ClipboardEventHandler;
150 type TransitionEventHandler = (event: TransitionEvent) => mixed;
151 type TransitionEventListener =
152 | {handleEvent: TransitionEventHandler, ...}
153 | TransitionEventHandler;
154 type MessageEventHandler = (event: MessageEvent<>) => mixed;
155 type MessageEventListener =
156 | {handleEvent: MessageEventHandler, ...}
157 | MessageEventHandler;
158 type BeforeUnloadEventHandler = (event: BeforeUnloadEvent) => mixed;
159 type BeforeUnloadEventListener =
160 | {handleEvent: BeforeUnloadEventHandler, ...}
161 | BeforeUnloadEventHandler;
162 type StorageEventHandler = (event: StorageEvent) => mixed;
163 type StorageEventListener =
164 | {handleEvent: StorageEventHandler, ...}
165 | StorageEventHandler;
166 type SecurityPolicyViolationEventHandler = (
167 event: SecurityPolicyViolationEvent
168 ) => mixed;
169 type SecurityPolicyViolationEventListener =
170 | {handleEvent: SecurityPolicyViolationEventHandler, ...}
171 | SecurityPolicyViolationEventHandler;
172 type USBConnectionEventHandler = (event: USBConnectionEvent) => mixed;
173 type USBConnectionEventListener =
174 | {handleEvent: USBConnectionEventHandler, ...}
175 | USBConnectionEventHandler;
176
177 type MediaKeySessionType = 'temporary' | 'persistent-license';
178 type MediaKeyStatus =
179 | 'usable'
180 | 'expired'
181 | 'released'
182 | 'output-restricted'
183 | 'output-downscaled'
184 | 'status-pending'
185 | 'internal-error';
186 type MouseEventTypes =
187 | 'contextmenu'
188 | 'mousedown'
189 | 'mouseenter'
190 | 'mouseleave'
191 | 'mousemove'
192 | 'mouseout'
193 | 'mouseover'
194 | 'mouseup'
195 | 'click'
196 | 'dblclick';
197 type FocusEventTypes = 'blur' | 'focus' | 'focusin' | 'focusout';
198 type KeyboardEventTypes = 'keydown' | 'keyup' | 'keypress';
199 type InputEventTypes = 'input' | 'beforeinput';
200 type TouchEventTypes = 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel';
201 type WheelEventTypes = 'wheel';
202 type AbortProgressEventTypes = 'abort';
203 type ProgressEventTypes =
204 | 'abort'
205 | 'error'
206 | 'load'
207 | 'loadend'
208 | 'loadstart'
209 | 'progress'
210 | 'timeout';
211 type DragEventTypes =
212 | 'drag'
213 | 'dragend'
214 | 'dragenter'
215 | 'dragexit'
216 | 'dragleave'
217 | 'dragover'
218 | 'dragstart'
219 | 'drop';
220 type PointerEventTypes =
221 | 'pointerover'
222 | 'pointerenter'
223 | 'pointerdown'
224 | 'pointermove'
225 | 'pointerup'
226 | 'pointercancel'
227 | 'pointerout'
228 | 'pointerleave'
229 | 'gotpointercapture'
230 | 'lostpointercapture';
231 type AnimationEventTypes =
232 | 'animationstart'
233 | 'animationend'
234 | 'animationiteration';
235 type ClipboardEventTypes = 'clipboardchange' | 'cut' | 'copy' | 'paste';
236 type TransitionEventTypes =
237 | 'transitionrun'
238 | 'transitionstart'
239 | 'transitionend'
240 | 'transitioncancel';
241 type MessageEventTypes = string;
242 type BeforeUnloadEventTypes = 'beforeunload';
243 type StorageEventTypes = 'storage';
244 type SecurityPolicyViolationEventTypes = 'securitypolicyviolation';
245 type USBConnectionEventTypes = 'connect' | 'disconnect';
246 type ToggleEventTypes = 'beforetoggle' | 'toggle';
247 type EventListenerOptionsOrUseCapture =
248 | boolean
249 | {
250 capture?: boolean,
251 once?: boolean,
252 passive?: boolean,
253 signal?: AbortSignal,
254 ...
255 };
256
257 declare class EventTarget {
258 addEventListener(
259 type: MouseEventTypes,
260 listener: MouseEventListener,
261 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
262 ): void;
263 addEventListener(
264 type: FocusEventTypes,
265 listener: FocusEventListener,
266 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
267 ): void;
268 addEventListener(
269 type: KeyboardEventTypes,
270 listener: KeyboardEventListener,
271 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
272 ): void;
273 addEventListener(
274 type: InputEventTypes,
275 listener: InputEventListener,
276 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
277 ): void;
278 addEventListener(
279 type: TouchEventTypes,
280 listener: TouchEventListener,
281 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
282 ): void;
283 addEventListener(
284 type: WheelEventTypes,
285 listener: WheelEventListener,
286 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
287 ): void;
288 addEventListener(
289 type: AbortProgressEventTypes,
290 listener: AbortProgressEventListener,
291 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
292 ): void;
293 addEventListener(
294 type: ProgressEventTypes,
295 listener: ProgressEventListener,
296 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
297 ): void;
298 addEventListener(
299 type: DragEventTypes,
300 listener: DragEventListener,
301 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
302 ): void;
303 addEventListener(
304 type: PointerEventTypes,
305 listener: PointerEventListener,
306 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
307 ): void;
308 addEventListener(
309 type: AnimationEventTypes,
310 listener: AnimationEventListener,
311 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
312 ): void;
313 addEventListener(
314 type: ClipboardEventTypes,
315 listener: ClipboardEventListener,
316 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
317 ): void;
318 addEventListener(
319 type: TransitionEventTypes,
320 listener: TransitionEventListener,
321 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
322 ): void;
323 addEventListener(
324 type: MessageEventTypes,
325 listener: MessageEventListener,
326 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
327 ): void;
328 addEventListener(
329 type: BeforeUnloadEventTypes,
330 listener: BeforeUnloadEventListener,
331 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
332 ): void;
333 addEventListener(
334 type: StorageEventTypes,
335 listener: StorageEventListener,
336 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
337 ): void;
338 addEventListener(
339 type: SecurityPolicyViolationEventTypes,
340 listener: SecurityPolicyViolationEventListener,
341 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
342 ): void;
343 addEventListener(
344 type: USBConnectionEventTypes,
345 listener: USBConnectionEventListener,
346 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
347 ): void;
348 addEventListener(
349 type: string,
350 listener: EventListener,
351 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
352 ): void;
353
354 removeEventListener(
355 type: MouseEventTypes,
356 listener: MouseEventListener,
357 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
358 ): void;
359 removeEventListener(
360 type: FocusEventTypes,
361 listener: FocusEventListener,
362 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
363 ): void;
364 removeEventListener(
365 type: KeyboardEventTypes,
366 listener: KeyboardEventListener,
367 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
368 ): void;
369 removeEventListener(
370 type: InputEventTypes,
371 listener: InputEventListener,
372 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
373 ): void;
374 removeEventListener(
375 type: TouchEventTypes,
376 listener: TouchEventListener,
377 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
378 ): void;
379 removeEventListener(
380 type: WheelEventTypes,
381 listener: WheelEventListener,
382 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
383 ): void;
384 removeEventListener(
385 type: AbortProgressEventTypes,
386 listener: AbortProgressEventListener,
387 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
388 ): void;
389 removeEventListener(
390 type: ProgressEventTypes,
391 listener: ProgressEventListener,
392 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
393 ): void;
394 removeEventListener(
395 type: DragEventTypes,
396 listener: DragEventListener,
397 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
398 ): void;
399 removeEventListener(
400 type: PointerEventTypes,
401 listener: PointerEventListener,
402 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
403 ): void;
404 removeEventListener(
405 type: AnimationEventTypes,
406 listener: AnimationEventListener,
407 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
408 ): void;
409 removeEventListener(
410 type: ClipboardEventTypes,
411 listener: ClipboardEventListener,
412 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
413 ): void;
414 removeEventListener(
415 type: TransitionEventTypes,
416 listener: TransitionEventListener,
417 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
418 ): void;
419 removeEventListener(
420 type: MessageEventTypes,
421 listener: MessageEventListener,
422 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
423 ): void;
424 removeEventListener(
425 type: BeforeUnloadEventTypes,
426 listener: BeforeUnloadEventListener,
427 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
428 ): void;
429 removeEventListener(
430 type: StorageEventTypes,
431 listener: StorageEventListener,
432 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
433 ): void;
434 removeEventListener(
435 type: SecurityPolicyViolationEventTypes,
436 listener: SecurityPolicyViolationEventListener,
437 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
438 ): void;
439 removeEventListener(
440 type: USBConnectionEventTypes,
441 listener: USBConnectionEventListener,
442 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
443 ): void;
444 removeEventListener(
445 type: string,
446 listener: EventListener,
447 optionsOrUseCapture?: EventListenerOptionsOrUseCapture
448 ): void;
449
450 attachEvent?: (type: MouseEventTypes, listener: MouseEventListener) => void;
451 attachEvent?: (type: FocusEventTypes, listener: FocusEventListener) => void;
452 attachEvent?: (
453 type: KeyboardEventTypes,
454 listener: KeyboardEventListener
455 ) => void;
456 attachEvent?: (type: InputEventTypes, listener: InputEventListener) => void;
457 attachEvent?: (type: TouchEventTypes, listener: TouchEventListener) => void;
458 attachEvent?: (type: WheelEventTypes, listener: WheelEventListener) => void;
459 attachEvent?: (
460 type: AbortProgressEventTypes,
461 listener: AbortProgressEventListener
462 ) => void;
463 attachEvent?: (
464 type: ProgressEventTypes,
465 listener: ProgressEventListener
466 ) => void;
467 attachEvent?: (type: DragEventTypes, listener: DragEventListener) => void;
468 attachEvent?: (
469 type: PointerEventTypes,
470 listener: PointerEventListener
471 ) => void;
472 attachEvent?: (
473 type: AnimationEventTypes,
474 listener: AnimationEventListener
475 ) => void;
476 attachEvent?: (
477 type: ClipboardEventTypes,
478 listener: ClipboardEventListener
479 ) => void;
480 attachEvent?: (
481 type: TransitionEventTypes,
482 listener: TransitionEventListener
483 ) => void;
484 attachEvent?: (
485 type: MessageEventTypes,
486 listener: MessageEventListener
487 ) => void;
488 attachEvent?: (
489 type: BeforeUnloadEventTypes,
490 listener: BeforeUnloadEventListener
491 ) => void;
492 attachEvent?: (
493 type: StorageEventTypes,
494 listener: StorageEventListener
495 ) => void;
496 attachEvent?: (
497 type: USBConnectionEventTypes,
498 listener: USBConnectionEventListener
499 ) => void;
500 attachEvent?: (type: string, listener: EventListener) => void;
501
502 detachEvent?: (type: MouseEventTypes, listener: MouseEventListener) => void;
503 detachEvent?: (type: FocusEventTypes, listener: FocusEventListener) => void;
504 detachEvent?: (
505 type: KeyboardEventTypes,
506 listener: KeyboardEventListener
507 ) => void;
508 detachEvent?: (type: InputEventTypes, listener: InputEventListener) => void;
509 detachEvent?: (type: TouchEventTypes, listener: TouchEventListener) => void;
510 detachEvent?: (type: WheelEventTypes, listener: WheelEventListener) => void;
511 detachEvent?: (
512 type: AbortProgressEventTypes,
513 listener: AbortProgressEventListener
514 ) => void;
515 detachEvent?: (
516 type: ProgressEventTypes,
517 listener: ProgressEventListener
518 ) => void;
519 detachEvent?: (type: DragEventTypes, listener: DragEventListener) => void;
520 detachEvent?: (
521 type: PointerEventTypes,
522 listener: PointerEventListener
523 ) => void;
524 detachEvent?: (
525 type: AnimationEventTypes,
526 listener: AnimationEventListener
527 ) => void;
528 detachEvent?: (
529 type: ClipboardEventTypes,
530 listener: ClipboardEventListener
531 ) => void;
532 detachEvent?: (
533 type: TransitionEventTypes,
534 listener: TransitionEventListener
535 ) => void;
536 detachEvent?: (
537 type: MessageEventTypes,
538 listener: MessageEventListener
539 ) => void;
540 detachEvent?: (
541 type: BeforeUnloadEventTypes,
542 listener: BeforeUnloadEventListener
543 ) => void;
544 detachEvent?: (
545 type: StorageEventTypes,
546 listener: StorageEventListener
547 ) => void;
548 detachEvent?: (
549 type: USBConnectionEventTypes,
550 listener: USBConnectionEventListener
551 ) => void;
552 detachEvent?: (type: string, listener: EventListener) => void;
553
554 dispatchEvent(evt: Event): boolean;
555
556 // Deprecated
557
558 cancelBubble: boolean;
559 initEvent(
560 eventTypeArg: string,
561 canBubbleArg: boolean,
562 cancelableArg: boolean
563 ): void;
564 }
565
566 // https://dom.spec.whatwg.org/#dictdef-eventinit
567 type Event$Init = {
568 bubbles?: boolean,
569 cancelable?: boolean,
570 composed?: boolean,
571 /** Non-standard. See `composed` instead. */
572 scoped?: boolean,
573 ...
574 };
575
576 // https://dom.spec.whatwg.org/#interface-event
577 declare class Event {
578 constructor(type: string, eventInitDict?: Event$Init): void;
579 /**
580 * Returns the type of event, e.g. "click", "hashchange", or "submit".
581 */
582 +type: string;
583 /**
584 * Returns the object to which event is dispatched (its target).
585 */
586 +target: EventTarget; // TODO: nullable
587 /** @deprecated */
588 +srcElement: Element; // TODO: nullable
589 /**
590 * Returns the object whose event listener's callback is currently being invoked.
591 */
592 +currentTarget: EventTarget; // TODO: nullable
593 /**
594 * Returns the invocation target objects of event's path (objects on which
595 * listeners will be invoked), except for any nodes in shadow trees of which
596 * the shadow root's mode is "closed" that are not reachable from event's
597 * currentTarget.
598 */
599 composedPath(): Array<EventTarget>;
600
601 +NONE: number;
602 +AT_TARGET: number;
603 +BUBBLING_PHASE: number;
604 +CAPTURING_PHASE: number;
605 /**
606 * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET,
607 * and BUBBLING_PHASE.
608 */
609 +eventPhase: number;
610
611 /**
612 * When dispatched in a tree, invoking this method prevents event from reaching
613 * any objects other than the current object.
614 */
615 stopPropagation(): void;
616 /**
617 * Invoking this method prevents event from reaching any registered event
618 * listeners after the current one finishes running and, when dispatched in a
619 * tree, also prevents event from reaching any other objects.
620 */
621 stopImmediatePropagation(): void;
622
623 /**
624 * Returns true or false depending on how event was initialized. True if
625 * event goes through its target's ancestors in reverse tree order, and
626 * false otherwise.
627 */
628 +bubbles: boolean;
629 /**
630 * Returns true or false depending on how event was initialized. Its
631 * return value does not always carry meaning, but true can indicate
632 * that part of the operation during which event was dispatched, can
633 * be canceled by invoking the preventDefault() method.
634 */
635 +cancelable: boolean;
636 // returnValue: boolean; // legacy, and some subclasses still define it as a string!
637 /**
638 * If invoked when the cancelable attribute value is true, and while
639 * executing a listener for the event with passive set to false, signals to
640 * the operation that caused event to be dispatched that it needs to be
641 * canceled.
642 */
643 preventDefault(): void;
644 /**
645 * Returns true if preventDefault() was invoked successfully to indicate
646 * cancelation, and false otherwise.
647 */
648 +defaultPrevented: boolean;
649 /**
650 * Returns true or false depending on how event was initialized. True if
651 * event invokes listeners past a ShadowRoot node that is the root of its
652 * target, and false otherwise.
653 */
654 +composed: boolean;
655
656 /**
657 * Returns true if event was dispatched by the user agent, and false otherwise.
658 */
659 +isTrusted: boolean;
660 /**
661 * Returns the event's timestamp as the number of milliseconds measured relative
662 * to the time origin.
663 */
664 +timeStamp: number;
665
666 /** Non-standard. See Event.prototype.composedPath */
667 +deepPath?: () => EventTarget[];
668 /** Non-standard. See Event.prototype.composed */
669 +scoped: boolean;
670
671 /**
672 * @deprecated
673 */
674 initEvent(type: string, bubbles: boolean, cancelable: boolean): void;
675 }
676
677 type CustomEvent$Init = {...Event$Init, detail?: any, ...};
678
679 declare class CustomEvent extends Event {
680 constructor(type: string, eventInitDict?: CustomEvent$Init): void;
681 detail: any;
682
683 // deprecated
684 initCustomEvent(
685 type: string,
686 bubbles: boolean,
687 cancelable: boolean,
688 detail: any
689 ): CustomEvent;
690 }
691
692 type UIEvent$Init = {...Event$Init, detail?: number, view?: any, ...};
693
694 declare class UIEvent extends Event {
695 constructor(typeArg: string, uiEventInit?: UIEvent$Init): void;
696 detail: number;
697 view: any;
698 }
699
700 declare class CompositionEvent extends UIEvent {
701 data: string | null;
702 locale: string;
703 }
704
705 type MouseEvent$MouseEventInit = {
706 screenX?: number,
707 screenY?: number,
708 clientX?: number,
709 clientY?: number,
710 ctrlKey?: boolean,
711 shiftKey?: boolean,
712 altKey?: boolean,
713 metaKey?: boolean,
714 button?: number,
715 buttons?: number,
716 region?: string | null,
717 relatedTarget?: EventTarget | null,
718 ...
719 };
720
721 declare class MouseEvent extends UIEvent {
722 constructor(
723 typeArg: string,
724 mouseEventInit?: MouseEvent$MouseEventInit
725 ): void;
726 altKey: boolean;
727 button: number;
728 buttons: number;
729 clientX: number;
730 clientY: number;
731 ctrlKey: boolean;
732 metaKey: boolean;
733 movementX: number;
734 movementY: number;
735 offsetX: number;
736 offsetY: number;
737 pageX: number;
738 pageY: number;
739 region: string | null;
740 relatedTarget: EventTarget | null;
741 screenX: number;
742 screenY: number;
743 shiftKey: boolean;
744 x: number;
745 y: number;
746 getModifierState(keyArg: string): boolean;
747 }
748
749 declare class FocusEvent extends UIEvent {
750 relatedTarget: ?EventTarget;
751 }
752
753 type WheelEvent$Init = {
754 ...MouseEvent$MouseEventInit,
755 deltaX?: number,
756 deltaY?: number,
757 deltaZ?: number,
758 deltaMode?: 0x00 | 0x01 | 0x02,
759 ...
760 };
761
762 declare class WheelEvent extends MouseEvent {
763 static +DOM_DELTA_PIXEL: 0x00;
764 static +DOM_DELTA_LINE: 0x01;
765 static +DOM_DELTA_PAGE: 0x02;
766
767 constructor(type: string, eventInitDict?: WheelEvent$Init): void;
768 +deltaX: number;
769 +deltaY: number;
770 +deltaZ: number;
771 +deltaMode: 0x00 | 0x01 | 0x02;
772 }
773
774 declare class DragEvent extends MouseEvent {
775 dataTransfer: ?DataTransfer; // readonly
776 }
777
778 type PointerEvent$PointerEventInit = MouseEvent$MouseEventInit & {
779 pointerId?: number,
780 width?: number,
781 height?: number,
782 pressure?: number,
783 tangentialPressure?: number,
784 tiltX?: number,
785 tiltY?: number,
786 twist?: number,
787 pointerType?: string,
788 isPrimary?: boolean,
789 ...
790 };
791
792 declare class PointerEvent extends MouseEvent {
793 constructor(
794 typeArg: string,
795 pointerEventInit?: PointerEvent$PointerEventInit
796 ): void;
797 pointerId: number;
798 width: number;
799 height: number;
800 pressure: number;
801 tangentialPressure: number;
802 tiltX: number;
803 tiltY: number;
804 twist: number;
805 pointerType: string;
806 isPrimary: boolean;
807 }
808
809 declare class ProgressEvent extends Event {
810 lengthComputable: boolean;
811 loaded: number;
812 total: number;
813
814 // Deprecated
815 initProgressEvent(
816 typeArg: string,
817 canBubbleArg: boolean,
818 cancelableArg: boolean,
819 lengthComputableArg: boolean,
820 loadedArg: number,
821 totalArg: number
822 ): void;
823 }
824
825 declare class PromiseRejectionEvent extends Event {
826 promise: Promise<any>;
827 reason: any;
828 }
829
830 type PageTransitionEventInit = {
831 ...Event$Init,
832 persisted: boolean,
833 ...
834 };
835
836 // https://html.spec.whatwg.org/multipage/browsing-the-web.html#the-pagetransitionevent-interface
837 declare class PageTransitionEvent extends Event {
838 constructor(type: string, init?: PageTransitionEventInit): void;
839 +persisted: boolean;
840 }
841
842 // used for websockets and postMessage, for example. See:
843 // https://www.w3.org/TR/2011/WD-websockets-20110419/
844 // and
845 // https://www.w3.org/TR/2008/WD-html5-20080610/comms.html
846 // and
847 // https://html.spec.whatwg.org/multipage/comms.html#the-messageevent-interfaces
848 declare class MessageEvent<Data = mixed> extends Event {
849 data: Data;
850 origin: string;
851 lastEventId: string;
852 source: WindowProxy;
853 }
854
855 // https://w3c.github.io/uievents/#idl-keyboardeventinit
856 type KeyboardEvent$Init = {
857 ...UIEvent$Init,
858 /**
859 * Initializes the `key` attribute of the KeyboardEvent object to the unicode
860 * character string representing the meaning of a key after taking into
861 * account all keyboard modifiers (such as shift-state). This value is the
862 * final effective value of the key. If the key is not a printable character,
863 * then it should be one of the key values defined in [UIEvents-Key](https://www.w3.org/TR/uievents-key/).
864 *
865 * NOTE: not `null`, this results in `evt.key === 'null'`!
866 */
867 key?: string | void,
868 /**
869 * Initializes the `code` attribute of the KeyboardEvent object to the unicode
870 * character string representing the key that was pressed, ignoring any
871 * keyboard modifications such as keyboard layout. This value should be one
872 * of the code values defined in [UIEvents-Code](https://www.w3.org/TR/uievents-code/).
873 *
874 * NOTE: not `null`, this results in `evt.code === 'null'`!
875 */
876 code?: string | void,
877 /**
878 * Initializes the `location` attribute of the KeyboardEvent object to one of
879 * the following location numerical constants:
880 *
881 * DOM_KEY_LOCATION_STANDARD (numerical value 0)
882 * DOM_KEY_LOCATION_LEFT (numerical value 1)
883 * DOM_KEY_LOCATION_RIGHT (numerical value 2)
884 * DOM_KEY_LOCATION_NUMPAD (numerical value 3)
885 */
886 location?: number,
887 /**
888 * Initializes the `ctrlKey` attribute of the KeyboardEvent object to true if
889 * the Control key modifier is to be considered active, false otherwise.
890 */
891 ctrlKey?: boolean,
892 /**
893 * Initializes the `shiftKey` attribute of the KeyboardEvent object to true if
894 * the Shift key modifier is to be considered active, false otherwise.
895 */
896 shiftKey?: boolean,
897 /**
898 * Initializes the `altKey` attribute of the KeyboardEvent object to true if
899 * the Alt (alternative) (or Option) key modifier is to be considered active,
900 * false otherwise.
901 */
902 altKey?: boolean,
903 /**
904 * Initializes the `metaKey` attribute of the KeyboardEvent object to true if
905 * the Meta key modifier is to be considered active, false otherwise.
906 */
907 metaKey?: boolean,
908 /**
909 * Initializes the `repeat` attribute of the KeyboardEvent object. This
910 * attribute should be set to true if the the current KeyboardEvent is
911 * considered part of a repeating sequence of similar events caused by the
912 * long depression of any single key, false otherwise.
913 */
914 repeat?: boolean,
915 /**
916 * Initializes the `isComposing` attribute of the KeyboardEvent object. This
917 * attribute should be set to true if the event being constructed occurs as
918 * part of a composition sequence, false otherwise.
919 */
920 isComposing?: boolean,
921 /**
922 * Initializes the `charCode` attribute of the KeyboardEvent to the Unicode
923 * code point for the event’s character.
924 */
925 charCode?: number,
926 /**
927 * Initializes the `keyCode` attribute of the KeyboardEvent to the system-
928 * and implementation-dependent numerical code signifying the unmodified
929 * identifier associated with the key pressed.
930 */
931 keyCode?: number,
932 /** Initializes the `which` attribute */
933 which?: number,
934 ...
935 };
936
937 // https://w3c.github.io/uievents/#idl-keyboardevent
938 declare class KeyboardEvent extends UIEvent {
939 constructor(typeArg: string, init?: KeyboardEvent$Init): void;
940
941 /** `true` if the Alt (alternative) (or "Option") key modifier was active. */
942 +altKey: boolean;
943 /**
944 * Holds a string that identifies the physical key being pressed. The value
945 * is not affected by the current keyboard layout or modifier state, so a
946 * particular key will always return the same value.
947 */
948 +code: string;
949 /** `true` if the Control (control) key modifier was active. */
950 +ctrlKey: boolean;
951 /**
952 * `true` if the key event occurs as part of a composition session, i.e.,
953 * after a `compositionstart` event and before the corresponding
954 * `compositionend` event.
955 */
956 +isComposing: boolean;
957 /**
958 * Holds a [key attribute value](https://www.w3.org/TR/uievents-key/#key-attribute-value)
959 * corresponding to the key pressed. */
960 +key: string;
961 /** An indication of the logical location of the key on the device. */
962 +location: number;
963 /** `true` if the meta (Meta) key (or "Command") modifier was active. */
964 +metaKey: boolean;
965 /** `true` if the key has been pressed in a sustained manner. */
966 +repeat: boolean;
967 /** `true` if the shift (Shift) key modifier was active. */
968 +shiftKey: boolean;
969
970 /**
971 * Queries the state of a modifier using a key value.
972 *
973 * Returns `true` if it is a modifier key and the modifier is activated,
974 * `false` otherwise.
975 */
976 getModifierState(keyArg?: string): boolean;
977
978 /**
979 * Holds a character value, for keypress events which generate character
980 * input. The value is the Unicode reference number (code point) of that
981 * character (e.g. event.charCode = event.key.charCodeAt(0) for printable
982 * characters). For keydown or keyup events, the value of charCode is 0.
983 *
984 * @deprecated You should use KeyboardEvent.key instead, if available.
985 */
986 +charCode: number;
987 /**
988 * Holds a system- and implementation-dependent numerical code signifying
989 * the unmodified identifier associated with the key pressed. Unlike the
990 * `key` attribute, the set of possible values are not normatively defined.
991 * Typically, these value of the keyCode SHOULD represent the decimal
992 * codepoint in ASCII or Windows 1252, but MAY be drawn from a different
993 * appropriate character set. Implementations that are unable to identify
994 * a key use the key value 0.
995 *
996 * @deprecated You should use KeyboardEvent.key instead, if available.
997 */
998 +keyCode: number;
999 /**
1000 * Holds a system- and implementation-dependent numerical code signifying
1001 * the unmodified identifier associated with the key pressed. In most cases,
1002 * the value is identical to keyCode.
1003 *
1004 * @deprecated You should use KeyboardEvent.key instead, if available.
1005 */
1006 +which: number;
1007 }
1008
1009 type InputEvent$Init = {
1010 ...UIEvent$Init,
1011 inputType?: string,
1012 data?: string,
1013 dataTransfer?: DataTransfer,
1014 isComposing?: boolean,
1015 ranges?: Array<any>, // TODO: StaticRange
1016 ...
1017 };
1018
1019 declare class InputEvent extends UIEvent {
1020 constructor(typeArg: string, inputEventInit: InputEvent$Init): void;
1021 +data: string | null;
1022 +dataTransfer: DataTransfer | null;
1023 +inputType: string;
1024 +isComposing: boolean;
1025 getTargetRanges(): Array<any>; // TODO: StaticRange
1026 }
1027
1028 declare class AnimationEvent extends Event {
1029 animationName: string;
1030 elapsedTime: number;
1031 pseudoElement: string;
1032
1033 // deprecated
1034
1035 initAnimationEvent: (
1036 type: 'animationstart' | 'animationend' | 'animationiteration',
1037 canBubble: boolean,
1038 cancelable: boolean,
1039 animationName: string,
1040 elapsedTime: number
1041 ) => void;
1042 }
1043
1044 // https://www.w3.org/TR/touch-events/#idl-def-Touch
1045 declare class Touch {
1046 clientX: number;
1047 clientY: number;
1048 identifier: number;
1049 pageX: number;
1050 pageY: number;
1051 screenX: number;
1052 screenY: number;
1053 target: EventTarget;
1054 }
1055
1056 // https://www.w3.org/TR/touch-events/#idl-def-TouchList
1057 // TouchList#item(index) will return null if n > #length. Should #item's
1058 // return type just been Touch?
1059 declare class TouchList {
1060 @@iterator(): Iterator<Touch>;
1061 length: number;
1062 item(index: number): null | Touch;
1063 [index: number]: Touch;
1064 }
1065
1066 // https://www.w3.org/TR/touch-events/#touchevent-interface
1067 declare class TouchEvent extends UIEvent {
1068 altKey: boolean;
1069 changedTouches: TouchList;
1070 ctrlKey: boolean;
1071 metaKey: boolean;
1072 shiftKey: boolean;
1073 targetTouches: TouchList;
1074 touches: TouchList;
1075 }
1076
1077 // https://www.w3.org/TR/clipboard-apis/#typedefdef-clipboarditemdata
1078 // Raw string | Blob are allowed per https://webidl.spec.whatwg.org/#es-promise
1079 type ClipboardItemData = string | Blob | Promise<string | Blob>;
1080
1081 type PresentationStyle = 'attachment' | 'inline' | 'unspecified';
1082
1083 type ClipboardItemOptions = {
1084 presentationStyle?: PresentationStyle,
1085 ...
1086 };
1087
1088 declare class ClipboardItem {
1089 +types: $ReadOnlyArray<string>;
1090 getType(type: string): Promise<Blob>;
1091 constructor(
1092 items: {[type: string]: ClipboardItemData},
1093 options?: ClipboardItemOptions
1094 ): void;
1095 }
1096
1097 // https://w3c.github.io/clipboard-apis/ as of 15 May 2018
1098 type ClipboardEvent$Init = {
1099 ...Event$Init,
1100 clipboardData: DataTransfer | null,
1101 ...
1102 };
1103
1104 declare class ClipboardEvent extends Event {
1105 constructor(type: ClipboardEventTypes, eventInit?: ClipboardEvent$Init): void;
1106 +clipboardData: ?DataTransfer; // readonly
1107 }
1108
1109 // https://www.w3.org/TR/2017/WD-css-transitions-1-20171130/#interface-transitionevent
1110 type TransitionEvent$Init = {
1111 ...Event$Init,
1112 propertyName: string,
1113 elapsedTime: number,
1114 pseudoElement: string,
1115 ...
1116 };
1117
1118 declare class TransitionEvent extends Event {
1119 constructor(
1120 type: TransitionEventTypes,
1121 eventInit?: TransitionEvent$Init
1122 ): void;
1123
1124 +propertyName: string; // readonly
1125 +elapsedTime: number; // readonly
1126 +pseudoElement: string; // readonly
1127 }
1128
1129 declare class SecurityPolicyViolationEvent extends Event {
1130 +documentURI: string;
1131 +referrer: string;
1132 +blockedURI: string;
1133 +effectiveDirective: string;
1134 +violatedDirective: string;
1135 +originalPolicy: string;
1136 +sourceFile: string;
1137 +sample: string;
1138 +disposition: 'enforce' | 'report';
1139 +statusCode: number;
1140 +lineNumber: number;
1141 +columnNumber: number;
1142 }
1143
1144 // https://developer.mozilla.org/en-US/docs/Web/API/USBConnectionEvent
1145 declare class USBConnectionEvent extends Event {
1146 device: USBDevice;
1147 }
1148
1149 // TODO: *Event
1150
1151 declare class AbortController {
1152 constructor(): void;
1153 +signal: AbortSignal;
1154 abort(reason?: any): void;
1155 }
1156
1157 declare class AbortSignal extends EventTarget {
1158 +aborted: boolean;
1159 +reason: any;
1160 abort(reason?: any): AbortSignal;
1161 onabort: (event: Event) => mixed;
1162 throwIfAborted(): void;
1163 timeout(time: number): AbortSignal;
1164 }
1165
1166 declare class Node extends EventTarget {
1167 baseURI: ?string;
1168 childNodes: NodeList<Node>;
1169 firstChild: ?Node;
1170 +isConnected: boolean;
1171 lastChild: ?Node;
1172 nextSibling: ?Node;
1173 nodeName: string;
1174 nodeType: number;
1175 nodeValue: string;
1176 ownerDocument: Document;
1177 parentElement: ?Element;
1178 parentNode: ?Node;
1179 previousSibling: ?Node;
1180 rootNode: Node;
1181 textContent: string;
1182 appendChild<T: Node>(newChild: T): T;
1183 cloneNode(deep?: boolean): this;
1184 compareDocumentPosition(other: Node): number;
1185 contains(other: ?Node): boolean;
1186 getRootNode(options?: {composed: boolean, ...}): Node;
1187 hasChildNodes(): boolean;
1188 insertBefore<T: Node>(newChild: T, refChild?: ?Node): T;
1189 isDefaultNamespace(namespaceURI: string): boolean;
1190 isEqualNode(arg: Node): boolean;
1191 isSameNode(other: Node): boolean;
1192 lookupNamespaceURI(prefix: string): string;
1193 lookupPrefix(namespaceURI: string): string;
1194 normalize(): void;
1195 removeChild<T: Node>(oldChild: T): T;
1196 replaceChild<T: Node>(newChild: Node, oldChild: T): T;
1197 replaceChildren(...nodes: $ReadOnlyArray<Node | string>): void;
1198 static ATTRIBUTE_NODE: number;
1199 static CDATA_SECTION_NODE: number;
1200 static COMMENT_NODE: number;
1201 static DOCUMENT_FRAGMENT_NODE: number;
1202 static DOCUMENT_NODE: number;
1203 static DOCUMENT_POSITION_CONTAINED_BY: number;
1204 static DOCUMENT_POSITION_CONTAINS: number;
1205 static DOCUMENT_POSITION_DISCONNECTED: number;
1206 static DOCUMENT_POSITION_FOLLOWING: number;
1207 static DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;
1208 static DOCUMENT_POSITION_PRECEDING: number;
1209 static DOCUMENT_TYPE_NODE: number;
1210 static ELEMENT_NODE: number;
1211 static ENTITY_NODE: number;
1212 static ENTITY_REFERENCE_NODE: number;
1213 static NOTATION_NODE: number;
1214 static PROCESSING_INSTRUCTION_NODE: number;
1215 static TEXT_NODE: number;
1216
1217 // Non-standard
1218 innerText?: string;
1219 outerText?: string;
1220 }
1221
1222 declare class NodeList<T> {
1223 @@iterator(): Iterator<T>;
1224 length: number;
1225 item(index: number): T;
1226 [index: number]: T;
1227
1228 forEach<This>(
1229 callbackfn: (this: This, value: T, index: number, list: NodeList<T>) => any,
1230 thisArg: This
1231 ): void;
1232 entries(): Iterator<[number, T]>;
1233 keys(): Iterator<number>;
1234 values(): Iterator<T>;
1235 }
1236
1237 declare class NamedNodeMap {
1238 @@iterator(): Iterator<Attr>;
1239 length: number;
1240 removeNamedItemNS(namespaceURI: string, localName: string): Attr;
1241 item(index: number): Attr;
1242 [index: number | string]: Attr;
1243 removeNamedItem(name: string): Attr;
1244 getNamedItem(name: string): Attr;
1245 setNamedItem(arg: Attr): Attr;
1246 getNamedItemNS(namespaceURI: string, localName: string): Attr;
1247 setNamedItemNS(arg: Attr): Attr;
1248 }
1249
1250 declare class Attr extends Node {
1251 isId: boolean;
1252 specified: boolean;
1253 ownerElement: Element | null;
1254 value: string;
1255 name: string;
1256 namespaceURI: string | null;
1257 prefix: string | null;
1258 localName: string;
1259 }
1260
1261 declare class HTMLCollection<+Elem: Element> {
1262 @@iterator(): Iterator<Elem>;
1263 length: number;
1264 item(nameOrIndex?: any, optionalIndex?: any): Elem | null;
1265 namedItem(name: string): Elem | null;
1266 // $FlowFixMe[incompatible-variance]
1267 [index: number | string]: Elem;
1268 }
1269
1270 // from https://www.w3.org/TR/custom-elements/#extensions-to-document-interface-to-register
1271 // See also https://github.com/w3c/webcomponents/
1272 type ElementRegistrationOptions = {
1273 +prototype?: {
1274 // from https://www.w3.org/TR/custom-elements/#types-of-callbacks
1275 // See also https://github.com/w3c/webcomponents/
1276 +createdCallback?: () => mixed,
1277 +attachedCallback?: () => mixed,
1278 +detachedCallback?: () => mixed,
1279 +attributeChangedCallback?: ((
1280 // attribute is set
1281 attributeLocalName: string,
1282 oldAttributeValue: null,
1283 newAttributeValue: string,
1284 attributeNamespace: string
1285 ) => mixed) &
1286 // attribute is changed
1287 ((
1288 attributeLocalName: string,
1289 oldAttributeValue: string,
1290 newAttributeValue: string,
1291 attributeNamespace: string
1292 ) => mixed) &
1293 // attribute is removed
1294 ((
1295 attributeLocalName: string,
1296 oldAttributeValue: string,
1297 newAttributeValue: null,
1298 attributeNamespace: string
1299 ) => mixed),
1300 ...
1301 },
1302 +extends?: string,
1303 ...
1304 };
1305
1306 type ElementCreationOptions = {is: string, ...};
1307
1308 declare class MutationRecord {
1309 type: 'attributes' | 'characterData' | 'childList';
1310 target: Node;
1311 addedNodes: NodeList<Node>;
1312 removedNodes: NodeList<Node>;
1313 previousSibling: ?Node;
1314 nextSibling: ?Node;
1315 attributeName: ?string;
1316 attributeNamespace: ?string;
1317 oldValue: ?string;
1318 }
1319
1320 type MutationObserverInitRequired =
1321 | {childList: true, ...}
1322 | {attributes: true, ...}
1323 | {characterData: true, ...};
1324
1325 declare type MutationObserverInit = MutationObserverInitRequired & {
1326 subtree?: boolean,
1327 attributeOldValue?: boolean,
1328 characterDataOldValue?: boolean,
1329 attributeFilter?: Array<string>,
1330 ...
1331 };
1332
1333 declare class MutationObserver {
1334 constructor(
1335 callback: (arr: Array<MutationRecord>, observer: MutationObserver) => mixed
1336 ): void;
1337 observe(target: Node, options: MutationObserverInit): void;
1338 takeRecords(): Array<MutationRecord>;
1339 disconnect(): void;
1340 }
1341
1342 declare class Document extends Node {
1343 +timeline: DocumentTimeline;
1344 getAnimations(): Array<Animation>;
1345 +URL: string;
1346 adoptNode<T: Node>(source: T): T;
1347 anchors: HTMLCollection<HTMLAnchorElement>;
1348 applets: HTMLCollection<HTMLAppletElement>;
1349 body: HTMLBodyElement | null;
1350 +characterSet: string;
1351 /**
1352 * Legacy alias of `characterSet`
1353 * @deprecated
1354 */
1355 +charset: string;
1356 close(): void;
1357 +contentType: string;
1358 cookie: string;
1359 createAttribute(name: string): Attr;
1360 createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr;
1361 createCDATASection(data: string): Text;
1362 createComment(data: string): Comment;
1363 createDocumentFragment(): DocumentFragment;
1364 createElement<TName: $Keys<HTMLElementTagNameMap>>(
1365 localName: TName,
1366 options?: string | ElementCreationOptions
1367 ): HTMLElementTagNameMap[TName];
1368 createElementNS<TName: $Keys<HTMLElementTagNameMap>>(
1369 namespaceURI: 'http://www.w3.org/1999/xhtml',
1370 qualifiedName: TName,
1371 options?: string | ElementCreationOptions
1372 ): HTMLElementTagNameMap[TName];
1373 createElementNS(
1374 namespaceURI: string | null,
1375 qualifiedName: string,
1376 options?: string | ElementCreationOptions
1377 ): Element;
1378 createTextNode(data: string): Text;
1379 currentScript: HTMLScriptElement | null;
1380 dir: 'rtl' | 'ltr';
1381 +doctype: DocumentType | null;
1382 +documentElement: HTMLElement | null;
1383 documentMode: number;
1384 +documentURI: string;
1385 domain: string | null;
1386 embeds: HTMLCollection<HTMLEmbedElement>;
1387 exitFullscreen(): Promise<void>;
1388 queryCommandSupported(cmdID: string): boolean;
1389 execCommand(cmdID: string, showUI?: boolean, value?: any): boolean;
1390 forms: HTMLCollection<HTMLFormElement>;
1391 fullscreenElement: Element | null;
1392 fullscreenEnabled: boolean;
1393 getElementsByClassName(classNames: string): HTMLCollection<HTMLElement>;
1394 getElementsByName(elementName: string): HTMLCollection<HTMLElement>;
1395 getElementsByTagName<TName: $Keys<HTMLElementTagNameMap>>(
1396 qualifiedName: TName
1397 ): HTMLCollection<HTMLElementTagNameMap[TName]>;
1398 getElementsByTagNameNS<TName: $Keys<HTMLElementTagNameMap>>(
1399 namespaceURI: 'http://www.w3.org/1999/xhtml',
1400 qualifiedName: TName
1401 ): HTMLCollection<HTMLElementTagNameMap[TName]>;
1402 getElementsByTagNameNS(
1403 namespaceURI: string | null,
1404 qualifiedName: string
1405 ): HTMLCollection<Element>;
1406 head: HTMLHeadElement | null;
1407 images: HTMLCollection<HTMLImageElement>;
1408 +implementation: DOMImplementation;
1409 importNode<T: Node>(importedNode: T, deep: boolean): T;
1410 /**
1411 * Legacy alias of `characterSet`
1412 * @deprecated
1413 */
1414 +inputEncoding: string;
1415 lastModified: string;
1416 links: HTMLCollection<HTMLLinkElement>;
1417 media: string;
1418 open(url?: string, name?: string, features?: string, replace?: boolean): any;
1419 /** @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/prerendering} */
1420 prerendering: boolean;
1421 readyState: string;
1422 referrer: string;
1423 scripts: HTMLCollection<HTMLScriptElement>;
1424 scrollingElement: HTMLElement | null;
1425 title: string;
1426 visibilityState: 'visible' | 'hidden' | 'prerender' | 'unloaded';
1427 write(...content: Array<string | TrustedHTML>): void;
1428 writeln(...content: Array<string | TrustedHTML>): void;
1429 xmlEncoding: string;
1430 xmlStandalone: boolean;
1431 xmlVersion: string;
1432
1433 registerElement(type: string, options?: ElementRegistrationOptions): any;
1434 getSelection(): Selection | null;
1435
1436 // 6.4.6 Focus management APIs
1437 activeElement: HTMLElement | null;
1438 hasFocus(): boolean;
1439
1440 // extension
1441 location: Location;
1442 createEvent(eventInterface: 'CustomEvent'): CustomEvent;
1443 createEvent(eventInterface: string): Event;
1444 createRange(): Range;
1445 elementFromPoint(x: number, y: number): HTMLElement | null;
1446 elementsFromPoint(x: number, y: number): Array<HTMLElement>;
1447 defaultView: any;
1448 +compatMode: 'BackCompat' | 'CSS1Compat';
1449 hidden: boolean;
1450
1451 // Pointer Lock specification
1452 exitPointerLock(): void;
1453 pointerLockElement: Element | null;
1454
1455 // from ParentNode interface
1456 childElementCount: number;
1457 children: HTMLCollection<HTMLElement>;
1458 firstElementChild: ?Element;
1459 lastElementChild: ?Element;
1460 append(...nodes: Array<string | Node>): void;
1461 prepend(...nodes: Array<string | Node>): void;
1462
1463 querySelector<TSelector: $Keys<HTMLElementTagNameMap>>(
1464 selector: TSelector
1465 ): HTMLElementTagNameMap[TSelector] | null;
1466 querySelectorAll<TSelector: $Keys<HTMLElementTagNameMap>>(
1467 selector: TSelector
1468 ): NodeList<HTMLElementTagNameMap[TSelector]>;
1469 // Interface DocumentTraversal
1470 // http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/traversal.html#Traversal-Document
1471
1472 // Not all combinations of RootNodeT and whatToShow are logically possible.
1473 // The bitmasks NodeFilter.SHOW_CDATA_SECTION,
1474 // NodeFilter.SHOW_ENTITY_REFERENCE, NodeFilter.SHOW_ENTITY, and
1475 // NodeFilter.SHOW_NOTATION are deprecated and do not correspond to types
1476 // that Flow knows about.
1477
1478 // NodeFilter.SHOW_ATTRIBUTE is also deprecated, but corresponds to the
1479 // type Attr. While there is no reason to prefer it to Node.attributes,
1480 // it does have meaning and can be typed: When (whatToShow &
1481 // NodeFilter.SHOW_ATTRIBUTE === 1), RootNodeT must be Attr, and when
1482 // RootNodeT is Attr, bitmasks other than NodeFilter.SHOW_ATTRIBUTE are
1483 // meaningless.
1484 createNodeIterator<RootNodeT: Attr>(
1485 root: RootNodeT,
1486 whatToShow: 2,
1487 filter?: NodeFilterInterface
1488 ): NodeIterator<RootNodeT, Attr>;
1489 createTreeWalker<RootNodeT: Attr>(
1490 root: RootNodeT,
1491 whatToShow: 2,
1492 filter?: NodeFilterInterface,
1493 entityReferenceExpansion?: boolean
1494 ): TreeWalker<RootNodeT, Attr>;
1495
1496 // NodeFilter.SHOW_PROCESSING_INSTRUCTION is not implemented because Flow
1497 // does not currently define a ProcessingInstruction class.
1498
1499 // When (whatToShow & NodeFilter.SHOW_DOCUMENT === 1 || whatToShow &
1500 // NodeFilter.SHOW_DOCUMENT_TYPE === 1), RootNodeT must be Document.
1501 createNodeIterator<RootNodeT: Document>(
1502 root: RootNodeT,
1503 whatToShow: 256,
1504 filter?: NodeFilterInterface
1505 ): NodeIterator<RootNodeT, Document>;
1506 createNodeIterator<RootNodeT: Document>(
1507 root: RootNodeT,
1508 whatToShow: 257,
1509 filter?: NodeFilterInterface
1510 ): NodeIterator<RootNodeT, Document | Element>;
1511 createNodeIterator<RootNodeT: Document>(
1512 root: RootNodeT,
1513 whatToShow: 260,
1514 filter?: NodeFilterInterface
1515 ): NodeIterator<RootNodeT, Document | Text>;
1516 createNodeIterator<RootNodeT: Document>(
1517 root: RootNodeT,
1518 whatToShow: 261,
1519 filter?: NodeFilterInterface
1520 ): NodeIterator<RootNodeT, Document | Element | Text>;
1521 createNodeIterator<RootNodeT: Document>(
1522 root: RootNodeT,
1523 whatToShow: 384,
1524 filter?: NodeFilterInterface
1525 ): NodeIterator<RootNodeT, Document | Comment>;
1526 createNodeIterator<RootNodeT: Document>(
1527 root: RootNodeT,
1528 whatToShow: 385,
1529 filter?: NodeFilterInterface
1530 ): NodeIterator<RootNodeT, Document | Element | Comment>;
1531 createNodeIterator<RootNodeT: Document>(
1532 root: RootNodeT,
1533 whatToShow: 388,
1534 filter?: NodeFilterInterface
1535 ): NodeIterator<RootNodeT, Document | Text | Comment>;
1536 createNodeIterator<RootNodeT: Document>(
1537 root: RootNodeT,
1538 whatToShow: 389,
1539 filter?: NodeFilterInterface
1540 ): NodeIterator<RootNodeT, Document | Element | Text | Comment>;
1541 createNodeIterator<RootNodeT: Document>(
1542 root: RootNodeT,
1543 whatToShow: 512,
1544 filter?: NodeFilterInterface
1545 ): NodeIterator<RootNodeT, DocumentType>;
1546 createNodeIterator<RootNodeT: Document>(
1547 root: RootNodeT,
1548 whatToShow: 513,
1549 filter?: NodeFilterInterface
1550 ): NodeIterator<RootNodeT, DocumentType | Element>;
1551 createNodeIterator<RootNodeT: Document>(
1552 root: RootNodeT,
1553 whatToShow: 516,
1554 filter?: NodeFilterInterface
1555 ): NodeIterator<RootNodeT, DocumentType | Text>;
1556 createNodeIterator<RootNodeT: Document>(
1557 root: RootNodeT,
1558 whatToShow: 517,
1559 filter?: NodeFilterInterface
1560 ): NodeIterator<RootNodeT, DocumentType | Element | Text>;
1561 createNodeIterator<RootNodeT: Document>(
1562 root: RootNodeT,
1563 whatToShow: 640,
1564 filter?: NodeFilterInterface
1565 ): NodeIterator<RootNodeT, DocumentType | Comment>;
1566 createNodeIterator<RootNodeT: Document>(
1567 root: RootNodeT,
1568 whatToShow: 641,
1569 filter?: NodeFilterInterface
1570 ): NodeIterator<RootNodeT, DocumentType | Element | Comment>;
1571 createNodeIterator<RootNodeT: Document>(
1572 root: RootNodeT,
1573 whatToShow: 644,
1574 filter?: NodeFilterInterface
1575 ): NodeIterator<RootNodeT, DocumentType | Text | Comment>;
1576 createNodeIterator<RootNodeT: Document>(
1577 root: RootNodeT,
1578 whatToShow: 645,
1579 filter?: NodeFilterInterface
1580 ): NodeIterator<RootNodeT, DocumentType | Element | Text | Comment>;
1581 createNodeIterator<RootNodeT: Document>(
1582 root: RootNodeT,
1583 whatToShow: 768,
1584 filter?: NodeFilterInterface
1585 ): NodeIterator<RootNodeT, DocumentType | Document>;
1586 createNodeIterator<RootNodeT: Document>(
1587 root: RootNodeT,
1588 whatToShow: 769,
1589 filter?: NodeFilterInterface
1590 ): NodeIterator<RootNodeT, DocumentType | Document | Element>;
1591 createNodeIterator<RootNodeT: Document>(
1592 root: RootNodeT,
1593 whatToShow: 772,
1594 filter?: NodeFilterInterface
1595 ): NodeIterator<RootNodeT, DocumentType | Document | Text>;
1596 createNodeIterator<RootNodeT: Document>(
1597 root: RootNodeT,
1598 whatToShow: 773,
1599 filter?: NodeFilterInterface
1600 ): NodeIterator<RootNodeT, DocumentType | Document | Element | Text>;
1601 createNodeIterator<RootNodeT: Document>(
1602 root: RootNodeT,
1603 whatToShow: 896,
1604 filter?: NodeFilterInterface
1605 ): NodeIterator<RootNodeT, DocumentType | Document | Comment>;
1606 createNodeIterator<RootNodeT: Document>(
1607 root: RootNodeT,
1608 whatToShow: 897,
1609 filter?: NodeFilterInterface
1610 ): NodeIterator<RootNodeT, DocumentType | Document | Element | Comment>;
1611 createNodeIterator<RootNodeT: Document>(
1612 root: RootNodeT,
1613 whatToShow: 900,
1614 filter?: NodeFilterInterface
1615 ): NodeIterator<RootNodeT, DocumentType | Document | Text | Comment>;
1616 createNodeIterator<RootNodeT: Document>(
1617 root: RootNodeT,
1618 whatToShow: 901,
1619 filter?: NodeFilterInterface
1620 ): NodeIterator<
1621 RootNodeT,
1622 DocumentType | Document | Element | Text | Comment,
1623 >;
1624 createTreeWalker<RootNodeT: Document>(
1625 root: RootNodeT,
1626 whatToShow: 256,
1627 filter?: NodeFilterInterface,
1628 entityReferenceExpansion?: boolean
1629 ): TreeWalker<RootNodeT, Document>;
1630 createTreeWalker<RootNodeT: Document>(
1631 root: RootNodeT,
1632 whatToShow: 257,
1633 filter?: NodeFilterInterface,
1634 entityReferenceExpansion?: boolean
1635 ): TreeWalker<RootNodeT, Document | Element>;
1636 createTreeWalker<RootNodeT: Document>(
1637 root: RootNodeT,
1638 whatToShow: 260,
1639 filter?: NodeFilterInterface,
1640 entityReferenceExpansion?: boolean
1641 ): TreeWalker<RootNodeT, Document | Text>;
1642 createTreeWalker<RootNodeT: Document>(
1643 root: RootNodeT,
1644 whatToShow: 261,
1645 filter?: NodeFilterInterface,
1646 entityReferenceExpansion?: boolean
1647 ): TreeWalker<RootNodeT, Document | Element | Text>;
1648 createTreeWalker<RootNodeT: Document>(
1649 root: RootNodeT,
1650 whatToShow: 384,
1651 filter?: NodeFilterInterface,
1652 entityReferenceExpansion?: boolean
1653 ): TreeWalker<RootNodeT, Document | Comment>;
1654 createTreeWalker<RootNodeT: Document>(
1655 root: RootNodeT,
1656 whatToShow: 385,
1657 filter?: NodeFilterInterface,
1658 entityReferenceExpansion?: boolean
1659 ): TreeWalker<RootNodeT, Document | Element | Comment>;
1660 createTreeWalker<RootNodeT: Document>(
1661 root: RootNodeT,
1662 whatToShow: 388,
1663 filter?: NodeFilterInterface,
1664 entityReferenceExpansion?: boolean
1665 ): TreeWalker<RootNodeT, Document | Text | Comment>;
1666 createTreeWalker<RootNodeT: Document>(
1667 root: RootNodeT,
1668 whatToShow: 389,
1669 filter?: NodeFilterInterface,
1670 entityReferenceExpansion?: boolean
1671 ): TreeWalker<RootNodeT, Document | Element | Text | Comment>;
1672 createTreeWalker<RootNodeT: Document>(
1673 root: RootNodeT,
1674 whatToShow: 512,
1675 filter?: NodeFilterInterface,
1676 entityReferenceExpansion?: boolean
1677 ): TreeWalker<RootNodeT, DocumentType>;
1678 createTreeWalker<RootNodeT: Document>(
1679 root: RootNodeT,
1680 whatToShow: 513,
1681 filter?: NodeFilterInterface,
1682 entityReferenceExpansion?: boolean
1683 ): TreeWalker<RootNodeT, DocumentType | Element>;
1684 createTreeWalker<RootNodeT: Document>(
1685 root: RootNodeT,
1686 whatToShow: 516,
1687 filter?: NodeFilterInterface,
1688 entityReferenceExpansion?: boolean
1689 ): TreeWalker<RootNodeT, DocumentType | Text>;
1690 createTreeWalker<RootNodeT: Document>(
1691 root: RootNodeT,
1692 whatToShow: 517,
1693 filter?: NodeFilterInterface,
1694 entityReferenceExpansion?: boolean
1695 ): TreeWalker<RootNodeT, DocumentType | Element | Text>;
1696 createTreeWalker<RootNodeT: Document>(
1697 root: RootNodeT,
1698 whatToShow: 640,
1699 filter?: NodeFilterInterface,
1700 entityReferenceExpansion?: boolean
1701 ): TreeWalker<RootNodeT, DocumentType | Comment>;
1702 createTreeWalker<RootNodeT: Document>(
1703 root: RootNodeT,
1704 whatToShow: 641,
1705 filter?: NodeFilterInterface,
1706 entityReferenceExpansion?: boolean
1707 ): TreeWalker<RootNodeT, DocumentType | Element | Comment>;
1708 createTreeWalker<RootNodeT: Document>(
1709 root: RootNodeT,
1710 whatToShow: 644,
1711 filter?: NodeFilterInterface,
1712 entityReferenceExpansion?: boolean
1713 ): TreeWalker<RootNodeT, DocumentType | Text | Comment>;
1714 createTreeWalker<RootNodeT: Document>(
1715 root: RootNodeT,
1716 whatToShow: 645,
1717 filter?: NodeFilterInterface,
1718 entityReferenceExpansion?: boolean
1719 ): TreeWalker<RootNodeT, DocumentType | Element | Text | Comment>;
1720 createTreeWalker<RootNodeT: Document>(
1721 root: RootNodeT,
1722 whatToShow: 768,
1723 filter?: NodeFilterInterface,
1724 entityReferenceExpansion?: boolean
1725 ): TreeWalker<RootNodeT, DocumentType | Document>;
1726 createTreeWalker<RootNodeT: Document>(
1727 root: RootNodeT,
1728 whatToShow: 769,
1729 filter?: NodeFilterInterface,
1730 entityReferenceExpansion?: boolean
1731 ): TreeWalker<RootNodeT, DocumentType | Document | Element>;
1732 createTreeWalker<RootNodeT: Document>(
1733 root: RootNodeT,
1734 whatToShow: 772,
1735 filter?: NodeFilterInterface,
1736 entityReferenceExpansion?: boolean
1737 ): TreeWalker<RootNodeT, DocumentType | Document | Text>;
1738 createTreeWalker<RootNodeT: Document>(
1739 root: RootNodeT,
1740 whatToShow: 773,
1741 filter?: NodeFilterInterface,
1742 entityReferenceExpansion?: boolean
1743 ): TreeWalker<RootNodeT, DocumentType | Document | Element | Text>;
1744 createTreeWalker<RootNodeT: Document>(
1745 root: RootNodeT,
1746 whatToShow: 896,
1747 filter?: NodeFilterInterface,
1748 entityReferenceExpansion?: boolean
1749 ): TreeWalker<RootNodeT, DocumentType | Document | Comment>;
1750 createTreeWalker<RootNodeT: Document>(
1751 root: RootNodeT,
1752 whatToShow: 897,
1753 filter?: NodeFilterInterface,
1754 entityReferenceExpansion?: boolean
1755 ): TreeWalker<RootNodeT, DocumentType | Document | Element | Comment>;
1756 createTreeWalker<RootNodeT: Document>(
1757 root: RootNodeT,
1758 whatToShow: 900,
1759 filter?: NodeFilterInterface,
1760 entityReferenceExpansion?: boolean
1761 ): TreeWalker<RootNodeT, DocumentType | Document | Text | Comment>;
1762 createTreeWalker<RootNodeT: Document>(
1763 root: RootNodeT,
1764 whatToShow: 901,
1765 filter?: NodeFilterInterface,
1766 entityReferenceExpansion?: boolean
1767 ): TreeWalker<RootNodeT, DocumentType | Document | Element | Text | Comment>;
1768
1769 // When (whatToShow & NodeFilter.SHOW_DOCUMENT_FRAGMENT === 1), RootNodeT
1770 // must be a DocumentFragment.
1771 createNodeIterator<RootNodeT: DocumentFragment>(
1772 root: RootNodeT,
1773 whatToShow: 1024,
1774 filter?: NodeFilterInterface
1775 ): NodeIterator<RootNodeT, DocumentFragment>;
1776 createNodeIterator<RootNodeT: DocumentFragment>(
1777 root: RootNodeT,
1778 whatToShow: 1025,
1779 filter?: NodeFilterInterface
1780 ): NodeIterator<RootNodeT, DocumentFragment | Element>;
1781 createNodeIterator<RootNodeT: DocumentFragment>(
1782 root: RootNodeT,
1783 whatToShow: 1028,
1784 filter?: NodeFilterInterface
1785 ): NodeIterator<RootNodeT, DocumentFragment | Text>;
1786 createNodeIterator<RootNodeT: DocumentFragment>(
1787 root: RootNodeT,
1788 whatToShow: 1029,
1789 filter?: NodeFilterInterface
1790 ): NodeIterator<RootNodeT, DocumentFragment | Element | Text>;
1791 createNodeIterator<RootNodeT: DocumentFragment>(
1792 root: RootNodeT,
1793 whatToShow: 1152,
1794 filter?: NodeFilterInterface
1795 ): NodeIterator<RootNodeT, DocumentFragment | Comment>;
1796 createNodeIterator<RootNodeT: DocumentFragment>(
1797 root: RootNodeT,
1798 whatToShow: 1153,
1799 filter?: NodeFilterInterface
1800 ): NodeIterator<RootNodeT, DocumentFragment | Element | Comment>;
1801 createNodeIterator<RootNodeT: DocumentFragment>(
1802 root: RootNodeT,
1803 whatToShow: 1156,
1804 filter?: NodeFilterInterface
1805 ): NodeIterator<RootNodeT, DocumentFragment | Text | Comment>;
1806 createNodeIterator<RootNodeT: DocumentFragment>(
1807 root: RootNodeT,
1808 whatToShow: 1157,
1809 filter?: NodeFilterInterface
1810 ): NodeIterator<RootNodeT, DocumentFragment | Element | Text | Comment>;
1811 createTreeWalker<RootNodeT: DocumentFragment>(
1812 root: RootNodeT,
1813 whatToShow: 1024,
1814 filter?: NodeFilterInterface,
1815 entityReferenceExpansion?: boolean
1816 ): TreeWalker<RootNodeT, DocumentFragment>;
1817 createTreeWalker<RootNodeT: DocumentFragment>(
1818 root: RootNodeT,
1819 whatToShow: 1025,
1820 filter?: NodeFilterInterface,
1821 entityReferenceExpansion?: boolean
1822 ): TreeWalker<RootNodeT, DocumentFragment | Element>;
1823 createTreeWalker<RootNodeT: DocumentFragment>(
1824 root: RootNodeT,
1825 whatToShow: 1028,
1826 filter?: NodeFilterInterface,
1827 entityReferenceExpansion?: boolean
1828 ): TreeWalker<RootNodeT, DocumentFragment | Text>;
1829 createTreeWalker<RootNodeT: DocumentFragment>(
1830 root: RootNodeT,
1831 whatToShow: 1029,
1832 filter?: NodeFilterInterface,
1833 entityReferenceExpansion?: boolean
1834 ): TreeWalker<RootNodeT, DocumentFragment | Element | Text>;
1835 createTreeWalker<RootNodeT: DocumentFragment>(
1836 root: RootNodeT,
1837 whatToShow: 1152,
1838 filter?: NodeFilterInterface,
1839 entityReferenceExpansion?: boolean
1840 ): TreeWalker<RootNodeT, DocumentFragment | Comment>;
1841 createTreeWalker<RootNodeT: DocumentFragment>(
1842 root: RootNodeT,
1843 whatToShow: 1153,
1844 filter?: NodeFilterInterface,
1845 entityReferenceExpansion?: boolean
1846 ): TreeWalker<RootNodeT, DocumentFragment | Element | Comment>;
1847 createTreeWalker<RootNodeT: DocumentFragment>(
1848 root: RootNodeT,
1849 whatToShow: 1156,
1850 filter?: NodeFilterInterface,
1851 entityReferenceExpansion?: boolean
1852 ): TreeWalker<RootNodeT, DocumentFragment | Text | Comment>;
1853 createTreeWalker<RootNodeT: DocumentFragment>(
1854 root: RootNodeT,
1855 whatToShow: 1157,
1856 filter?: NodeFilterInterface,
1857 entityReferenceExpansion?: boolean
1858 ): TreeWalker<RootNodeT, DocumentFragment | Element | Text | Comment>;
1859
1860 // In the general case, RootNodeT may be any Node and whatToShow may be
1861 // NodeFilter.SHOW_ALL or any combination of NodeFilter.SHOW_ELEMENT,
1862 // NodeFilter.SHOW_TEXT and/or NodeFilter.SHOW_COMMENT
1863 createNodeIterator<RootNodeT: Node>(
1864 root: RootNodeT,
1865 whatToShow: 1,
1866 filter?: NodeFilterInterface
1867 ): NodeIterator<RootNodeT, Element>;
1868 createNodeIterator<RootNodeT: Node>(
1869 root: RootNodeT,
1870 whatToShow: 4,
1871 filter?: NodeFilterInterface
1872 ): NodeIterator<RootNodeT, Text>;
1873 createNodeIterator<RootNodeT: Node>(
1874 root: RootNodeT,
1875 whatToShow: 5,
1876 filter?: NodeFilterInterface
1877 ): NodeIterator<RootNodeT, Element | Text>;
1878 createNodeIterator<RootNodeT: Node>(
1879 root: RootNodeT,
1880 whatToShow: 128,
1881 filter?: NodeFilterInterface
1882 ): NodeIterator<RootNodeT, Comment>;
1883 createNodeIterator<RootNodeT: Node>(
1884 root: RootNodeT,
1885 whatToShow: 129,
1886 filter?: NodeFilterInterface
1887 ): NodeIterator<RootNodeT, Element | Comment>;
1888 createNodeIterator<RootNodeT: Node>(
1889 root: RootNodeT,
1890 whatToShow: 132,
1891 filter?: NodeFilterInterface
1892 ): NodeIterator<RootNodeT, Text | Comment>;
1893 createNodeIterator<RootNodeT: Node>(
1894 root: RootNodeT,
1895 whatToShow: 133,
1896 filter?: NodeFilterInterface
1897 ): NodeIterator<RootNodeT, Text | Element | Comment>;
1898 createTreeWalker<RootNodeT: Node>(
1899 root: RootNodeT,
1900 whatToShow: 1,
1901 filter?: NodeFilterInterface,
1902 entityReferenceExpansion?: boolean
1903 ): TreeWalker<RootNodeT, Element>;
1904 createTreeWalker<RootNodeT: Node>(
1905 root: RootNodeT,
1906 whatToShow: 4,
1907 filter?: NodeFilterInterface,
1908 entityReferenceExpansion?: boolean
1909 ): TreeWalker<RootNodeT, Text>;
1910 createTreeWalker<RootNodeT: Node>(
1911 root: RootNodeT,
1912 whatToShow: 5,
1913 filter?: NodeFilterInterface,
1914 entityReferenceExpansion?: boolean
1915 ): TreeWalker<RootNodeT, Element | Text>;
1916 createTreeWalker<RootNodeT: Node>(
1917 root: RootNodeT,
1918 whatToShow: 128,
1919 filter?: NodeFilterInterface,
1920 entityReferenceExpansion?: boolean
1921 ): TreeWalker<RootNodeT, Comment>;
1922 createTreeWalker<RootNodeT: Node>(
1923 root: RootNodeT,
1924 whatToShow: 129,
1925 filter?: NodeFilterInterface,
1926 entityReferenceExpansion?: boolean
1927 ): TreeWalker<RootNodeT, Element | Comment>;
1928 createTreeWalker<RootNodeT: Node>(
1929 root: RootNodeT,
1930 whatToShow: 132,
1931 filter?: NodeFilterInterface,
1932 entityReferenceExpansion?: boolean
1933 ): TreeWalker<RootNodeT, Text | Comment>;
1934 createTreeWalker<RootNodeT: Node>(
1935 root: RootNodeT,
1936 whatToShow: 133,
1937 filter?: NodeFilterInterface,
1938 entityReferenceExpansion?: boolean
1939 ): TreeWalker<RootNodeT, Text | Element | Comment>;
1940
1941 // Catch all for when we don't know the value of `whatToShow`
1942 // And for when whatToShow is not provided, it is assumed to be SHOW_ALL
1943 createNodeIterator<RootNodeT: Node>(
1944 root: RootNodeT,
1945 whatToShow?: number,
1946 filter?: NodeFilterInterface
1947 ): NodeIterator<RootNodeT, Node>;
1948 createTreeWalker<RootNodeT: Node>(
1949 root: RootNodeT,
1950 whatToShow?: number,
1951 filter?: NodeFilterInterface,
1952 entityReferenceExpansion?: boolean
1953 ): TreeWalker<RootNodeT, Node>;
1954
1955 // From NonElementParentNode Mixin.
1956 getElementById(elementId: string): HTMLElement | null;
1957
1958 // From DocumentOrShadowRoot Mixin.
1959 +styleSheets: StyleSheetList;
1960 adoptedStyleSheets: Array<CSSStyleSheet>;
1961 }
1962
1963 declare class DocumentFragment extends Node {
1964 // from ParentNode interface
1965 childElementCount: number;
1966 children: HTMLCollection<HTMLElement>;
1967 firstElementChild: ?Element;
1968 lastElementChild: ?Element;
1969 append(...nodes: Array<string | Node>): void;
1970 prepend(...nodes: Array<string | Node>): void;
1971
1972 querySelector(selector: string): HTMLElement | null;
1973 querySelectorAll(selector: string): NodeList<HTMLElement>;
1974
1975 // From NonElementParentNode Mixin.
1976 getElementById(elementId: string): HTMLElement | null;
1977 }
1978
1979 declare class Selection {
1980 anchorNode: Node | null;
1981 anchorOffset: number;
1982 focusNode: Node | null;
1983 focusOffset: number;
1984 isCollapsed: boolean;
1985 rangeCount: number;
1986 type: string;
1987 addRange(range: Range): void;
1988 getRangeAt(index: number): Range;
1989 removeRange(range: Range): void;
1990 removeAllRanges(): void;
1991 collapse(parentNode: Node | null, offset?: number): void;
1992 collapseToStart(): void;
1993 collapseToEnd(): void;
1994 containsNode(aNode: Node, aPartlyContained?: boolean): boolean;
1995 deleteFromDocument(): void;
1996 extend(parentNode: Node, offset?: number): void;
1997 empty(): void;
1998 selectAllChildren(parentNode: Node): void;
1999 setPosition(aNode: Node | null, offset?: number): void;
2000 setBaseAndExtent(
2001 anchorNode: Node,
2002 anchorOffset: number,
2003 focusNode: Node,
2004 focusOffset: number
2005 ): void;
2006 toString(): string;
2007 }
2008
2009 declare class Range {
2010 // extension
2011 startOffset: number;
2012 collapsed: boolean;
2013 endOffset: number;
2014 startContainer: Node;
2015 endContainer: Node;
2016 commonAncestorContainer: Node;
2017 setStart(refNode: Node, offset: number): void;
2018 setEndBefore(refNode: Node): void;
2019 setStartBefore(refNode: Node): void;
2020 selectNode(refNode: Node): void;
2021 detach(): void;
2022 getBoundingClientRect(): DOMRect;
2023 toString(): string;
2024 compareBoundaryPoints(how: number, sourceRange: Range): number;
2025 insertNode(newNode: Node): void;
2026 collapse(toStart: boolean): void;
2027 selectNodeContents(refNode: Node): void;
2028 cloneContents(): DocumentFragment;
2029 setEnd(refNode: Node, offset: number): void;
2030 cloneRange(): Range;
2031 getClientRects(): DOMRectList;
2032 surroundContents(newParent: Node): void;
2033 deleteContents(): void;
2034 setStartAfter(refNode: Node): void;
2035 extractContents(): DocumentFragment;
2036 setEndAfter(refNode: Node): void;
2037 createContextualFragment(fragment: string | TrustedHTML): DocumentFragment;
2038 intersectsNode(refNode: Node): boolean;
2039 isPointInRange(refNode: Node, offset: number): boolean;
2040 static END_TO_END: number;
2041 static START_TO_START: number;
2042 static START_TO_END: number;
2043 static END_TO_START: number;
2044 }
2045
2046 declare var document: Document;
2047
2048 declare class DOMTokenList {
2049 @@iterator(): Iterator<string>;
2050 length: number;
2051 item(index: number): string;
2052 contains(token: string): boolean;
2053 add(...token: Array<string>): void;
2054 remove(...token: Array<string>): void;
2055 toggle(token: string, force?: boolean): boolean;
2056 replace(oldToken: string, newToken: string): boolean;
2057
2058 forEach(
2059 callbackfn: (value: string, index: number, list: DOMTokenList) => any,
2060 thisArg?: any
2061 ): void;
2062 entries(): Iterator<[number, string]>;
2063 keys(): Iterator<number>;
2064 values(): Iterator<string>;
2065 [index: number]: string;
2066 }
2067
2068 declare class Element extends Node mixins mixin$Animatable {
2069 assignedSlot: ?HTMLSlotElement;
2070 attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot;
2071 attributes: NamedNodeMap;
2072 classList: DOMTokenList;
2073 className: string;
2074 clientHeight: number;
2075 clientLeft: number;
2076 clientTop: number;
2077 clientWidth: number;
2078 id: string;
2079 // flowlint unsafe-getters-setters:off
2080 get innerHTML(): string;
2081 set innerHTML(value: string | TrustedHTML): void;
2082 // flowlint unsafe-getters-setters:error
2083 localName: string;
2084 namespaceURI: ?string;
2085 nextElementSibling: ?Element;
2086 // flowlint unsafe-getters-setters:off
2087 get outerHTML(): string;
2088 set outerHTML(value: string | TrustedHTML): void;
2089 // flowlint unsafe-getters-setters:error
2090 prefix: string | null;
2091 previousElementSibling: ?Element;
2092 scrollHeight: number;
2093 scrollLeft: number;
2094 scrollTop: number;
2095 scrollWidth: number;
2096 +tagName: string;
2097
2098 // TODO: a lot more ARIA properties
2099 ariaHidden: void | 'true' | 'false';
2100
2101 closest(selectors: string): ?Element;
2102
2103 getAttribute(name?: string): ?string;
2104 getAttributeNames(): Array<string>;
2105 getAttributeNS(namespaceURI: string | null, localName: string): string | null;
2106 getAttributeNode(name: string): Attr | null;
2107 getAttributeNodeNS(
2108 namespaceURI: string | null,
2109 localName: string
2110 ): Attr | null;
2111 getBoundingClientRect(): DOMRect;
2112 getClientRects(): DOMRectList;
2113 getElementsByClassName(names: string): HTMLCollection<HTMLElement>;
2114 getElementsByTagName<TName: $Keys<HTMLElementTagNameMap>>(
2115 qualifiedName: TName
2116 ): HTMLCollection<HTMLElementTagNameMap[TName]>;
2117 getElementsByTagNameNS<TName: $Keys<HTMLElementTagNameMap>>(
2118 namespaceURI: 'http://www.w3.org/1999/xhtml',
2119 qualifiedName: TName
2120 ): HTMLCollection<HTMLElementTagNameMap[TName]>;
2121 getElementsByTagNameNS(
2122 namespaceURI: string | null,
2123 qualifiedName: string
2124 ): HTMLCollection<Element>;
2125
2126 hasAttribute(name: string): boolean;
2127 hasAttributeNS(namespaceURI: string | null, localName: string): boolean;
2128 hasAttributes(): boolean;
2129 hasPointerCapture(pointerId: number): boolean;
2130 insertAdjacentElement(
2131 position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend',
2132 element: Element
2133 ): void;
2134 insertAdjacentHTML(
2135 position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend',
2136 html: string | TrustedHTML
2137 ): void;
2138 insertAdjacentText(
2139 position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend',
2140 text: string
2141 ): void;
2142 matches(selector: string): boolean;
2143 releasePointerCapture(pointerId: number): void;
2144 removeAttribute(name?: string): void;
2145 removeAttributeNode(attributeNode: Attr): Attr;
2146 removeAttributeNS(namespaceURI: string | null, localName: string): void;
2147 requestFullscreen(options?: {
2148 navigationUI: 'auto' | 'show' | 'hide',
2149 ...
2150 }): Promise<void>;
2151 requestPointerLock(): void;
2152 scrollIntoView(
2153 arg?:
2154 | boolean
2155 | {
2156 behavior?: 'auto' | 'instant' | 'smooth',
2157 block?: 'start' | 'center' | 'end' | 'nearest',
2158 inline?: 'start' | 'center' | 'end' | 'nearest',
2159 ...
2160 }
2161 ): void;
2162 scroll(x: number, y: number): void;
2163 scroll(options: ScrollToOptions): void;
2164 scrollTo(x: number, y: number): void;
2165 scrollTo(options: ScrollToOptions): void;
2166 scrollBy(x: number, y: number): void;
2167 scrollBy(options: ScrollToOptions): void;
2168 setAttribute(name?: string, value?: string): void;
2169 toggleAttribute(name?: string, force?: boolean): void;
2170 setAttributeNS(
2171 namespaceURI: string | null,
2172 qualifiedName: string,
2173 value: string
2174 ): void;
2175 setAttributeNode(newAttr: Attr): Attr | null;
2176 setAttributeNodeNS(newAttr: Attr): Attr | null;
2177 setPointerCapture(pointerId: number): void;
2178 shadowRoot?: ShadowRoot;
2179 slot?: string;
2180
2181 // from ParentNode interface
2182 childElementCount: number;
2183 children: HTMLCollection<HTMLElement>;
2184 firstElementChild: ?Element;
2185 lastElementChild: ?Element;
2186 append(...nodes: Array<string | Node>): void;
2187 prepend(...nodes: Array<string | Node>): void;
2188
2189 querySelector<TSelector: $Keys<HTMLElementTagNameMap>>(
2190 selector: TSelector
2191 ): HTMLElementTagNameMap[TSelector] | null;
2192 querySelectorAll<TSelector: $Keys<HTMLElementTagNameMap>>(
2193 selector: TSelector
2194 ): NodeList<HTMLElementTagNameMap[TSelector]>;
2195
2196 // from ChildNode interface
2197 after(...nodes: Array<string | Node>): void;
2198 before(...nodes: Array<string | Node>): void;
2199 replaceWith(...nodes: Array<string | Node>): void;
2200 remove(): void;
2201 }
2202
2203 declare class HitRegionOptions {
2204 path?: Path2D;
2205 fillRule?: CanvasFillRule;
2206 id?: string;
2207 parentID?: string;
2208 cursor?: string;
2209 control?: Element;
2210 label: ?string;
2211 role: ?string;
2212 }
2213
2214 declare class SVGMatrix {
2215 getComponent(index: number): number;
2216 mMultiply(secondMatrix: SVGMatrix): SVGMatrix;
2217 inverse(): SVGMatrix;
2218 mTranslate(x: number, y: number): SVGMatrix;
2219 mScale(scaleFactor: number): SVGMatrix;
2220 mRotate(angle: number): SVGMatrix;
2221 }
2222
2223 // WebGL idl: https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
2224
2225 type WebGLContextAttributes = {
2226 alpha: boolean,
2227 depth: boolean,
2228 stencil: boolean,
2229 antialias: boolean,
2230 premultipliedAlpha: boolean,
2231 preserveDrawingBuffer: boolean,
2232 preferLowPowerToHighPerformance: boolean,
2233 failIfMajorPerformanceCaveat: boolean,
2234 ...
2235 };
2236
2237 interface WebGLObject {}
2238
2239 interface WebGLBuffer extends WebGLObject {}
2240
2241 interface WebGLFramebuffer extends WebGLObject {}
2242
2243 interface WebGLProgram extends WebGLObject {}
2244
2245 interface WebGLRenderbuffer extends WebGLObject {}
2246
2247 interface WebGLShader extends WebGLObject {}
2248
2249 interface WebGLTexture extends WebGLObject {}
2250
2251 interface WebGLUniformLocation {}
2252
2253 interface WebGLActiveInfo {
2254 size: number;
2255 type: number;
2256 name: string;
2257 }
2258
2259 interface WebGLShaderPrecisionFormat {
2260 rangeMin: number;
2261 rangeMax: number;
2262 precision: number;
2263 }
2264
2265 type BufferDataSource = ArrayBuffer | $ArrayBufferView;
2266
2267 type TexImageSource =
2268 | ImageBitmap
2269 | ImageData
2270 | HTMLImageElement
2271 | HTMLCanvasElement
2272 | HTMLVideoElement;
2273
2274 type VertexAttribFVSource = Float32Array | Array<number>;
2275
2276 /* flow */
2277 declare class WebGLRenderingContext {
2278 static DEPTH_BUFFER_BIT: 0x00000100;
2279 DEPTH_BUFFER_BIT: 0x00000100;
2280 static STENCIL_BUFFER_BIT: 0x00000400;
2281 STENCIL_BUFFER_BIT: 0x00000400;
2282 static COLOR_BUFFER_BIT: 0x00004000;
2283 COLOR_BUFFER_BIT: 0x00004000;
2284 static POINTS: 0x0000;
2285 POINTS: 0x0000;
2286 static LINES: 0x0001;
2287 LINES: 0x0001;
2288 static LINE_LOOP: 0x0002;
2289 LINE_LOOP: 0x0002;
2290 static LINE_STRIP: 0x0003;
2291 LINE_STRIP: 0x0003;
2292 static TRIANGLES: 0x0004;
2293 TRIANGLES: 0x0004;
2294 static TRIANGLE_STRIP: 0x0005;
2295 TRIANGLE_STRIP: 0x0005;
2296 static TRIANGLE_FAN: 0x0006;
2297 TRIANGLE_FAN: 0x0006;
2298 static ZERO: 0;
2299 ZERO: 0;
2300 static ONE: 1;
2301 ONE: 1;
2302 static SRC_COLOR: 0x0300;
2303 SRC_COLOR: 0x0300;
2304 static ONE_MINUS_SRC_COLOR: 0x0301;
2305 ONE_MINUS_SRC_COLOR: 0x0301;
2306 static SRC_ALPHA: 0x0302;
2307 SRC_ALPHA: 0x0302;
2308 static ONE_MINUS_SRC_ALPHA: 0x0303;
2309 ONE_MINUS_SRC_ALPHA: 0x0303;
2310 static DST_ALPHA: 0x0304;
2311 DST_ALPHA: 0x0304;
2312 static ONE_MINUS_DST_ALPHA: 0x0305;
2313 ONE_MINUS_DST_ALPHA: 0x0305;
2314 static DST_COLOR: 0x0306;
2315 DST_COLOR: 0x0306;
2316 static ONE_MINUS_DST_COLOR: 0x0307;
2317 ONE_MINUS_DST_COLOR: 0x0307;
2318 static SRC_ALPHA_SATURATE: 0x0308;
2319 SRC_ALPHA_SATURATE: 0x0308;
2320 static FUNC_ADD: 0x8006;
2321 FUNC_ADD: 0x8006;
2322 static BLEND_EQUATION: 0x8009;
2323 BLEND_EQUATION: 0x8009;
2324 static BLEND_EQUATION_RGB: 0x8009;
2325 BLEND_EQUATION_RGB: 0x8009;
2326 static BLEND_EQUATION_ALPHA: 0x883d;
2327 BLEND_EQUATION_ALPHA: 0x883d;
2328 static FUNC_SUBTRACT: 0x800a;
2329 FUNC_SUBTRACT: 0x800a;
2330 static FUNC_REVERSE_SUBTRACT: 0x800b;
2331 FUNC_REVERSE_SUBTRACT: 0x800b;
2332 static BLEND_DST_RGB: 0x80c8;
2333 BLEND_DST_RGB: 0x80c8;
2334 static BLEND_SRC_RGB: 0x80c9;
2335 BLEND_SRC_RGB: 0x80c9;
2336 static BLEND_DST_ALPHA: 0x80ca;
2337 BLEND_DST_ALPHA: 0x80ca;
2338 static BLEND_SRC_ALPHA: 0x80cb;
2339 BLEND_SRC_ALPHA: 0x80cb;
2340 static CONSTANT_COLOR: 0x8001;
2341 CONSTANT_COLOR: 0x8001;
2342 static ONE_MINUS_CONSTANT_COLOR: 0x8002;
2343 ONE_MINUS_CONSTANT_COLOR: 0x8002;
2344 static CONSTANT_ALPHA: 0x8003;
2345 CONSTANT_ALPHA: 0x8003;
2346 static ONE_MINUS_CONSTANT_ALPHA: 0x8004;
2347 ONE_MINUS_CONSTANT_ALPHA: 0x8004;
2348 static BLEND_COLOR: 0x8005;
2349 BLEND_COLOR: 0x8005;
2350 static ARRAY_BUFFER: 0x8892;
2351 ARRAY_BUFFER: 0x8892;
2352 static ELEMENT_ARRAY_BUFFER: 0x8893;
2353 ELEMENT_ARRAY_BUFFER: 0x8893;
2354 static ARRAY_BUFFER_BINDING: 0x8894;
2355 ARRAY_BUFFER_BINDING: 0x8894;
2356 static ELEMENT_ARRAY_BUFFER_BINDING: 0x8895;
2357 ELEMENT_ARRAY_BUFFER_BINDING: 0x8895;
2358 static STREAM_DRAW: 0x88e0;
2359 STREAM_DRAW: 0x88e0;
2360 static STATIC_DRAW: 0x88e4;
2361 STATIC_DRAW: 0x88e4;
2362 static DYNAMIC_DRAW: 0x88e8;
2363 DYNAMIC_DRAW: 0x88e8;
2364 static BUFFER_SIZE: 0x8764;
2365 BUFFER_SIZE: 0x8764;
2366 static BUFFER_USAGE: 0x8765;
2367 BUFFER_USAGE: 0x8765;
2368 static CURRENT_VERTEX_ATTRIB: 0x8626;
2369 CURRENT_VERTEX_ATTRIB: 0x8626;
2370 static FRONT: 0x0404;
2371 FRONT: 0x0404;
2372 static BACK: 0x0405;
2373 BACK: 0x0405;
2374 static FRONT_AND_BACK: 0x0408;
2375 FRONT_AND_BACK: 0x0408;
2376 static CULL_FACE: 0x0b44;
2377 CULL_FACE: 0x0b44;
2378 static BLEND: 0x0be2;
2379 BLEND: 0x0be2;
2380 static DITHER: 0x0bd0;
2381 DITHER: 0x0bd0;
2382 static STENCIL_TEST: 0x0b90;
2383 STENCIL_TEST: 0x0b90;
2384 static DEPTH_TEST: 0x0b71;
2385 DEPTH_TEST: 0x0b71;
2386 static SCISSOR_TEST: 0x0c11;
2387 SCISSOR_TEST: 0x0c11;
2388 static POLYGON_OFFSET_FILL: 0x8037;
2389 POLYGON_OFFSET_FILL: 0x8037;
2390 static SAMPLE_ALPHA_TO_COVERAGE: 0x809e;
2391 SAMPLE_ALPHA_TO_COVERAGE: 0x809e;
2392 static SAMPLE_COVERAGE: 0x80a0;
2393 SAMPLE_COVERAGE: 0x80a0;
2394 static NO_ERROR: 0;
2395 NO_ERROR: 0;
2396 static INVALID_ENUM: 0x0500;
2397 INVALID_ENUM: 0x0500;
2398 static INVALID_VALUE: 0x0501;
2399 INVALID_VALUE: 0x0501;
2400 static INVALID_OPERATION: 0x0502;
2401 INVALID_OPERATION: 0x0502;
2402 static OUT_OF_MEMORY: 0x0505;
2403 OUT_OF_MEMORY: 0x0505;
2404 static CW: 0x0900;
2405 CW: 0x0900;
2406 static CCW: 0x0901;
2407 CCW: 0x0901;
2408 static LINE_WIDTH: 0x0b21;
2409 LINE_WIDTH: 0x0b21;
2410 static ALIASED_POINT_SIZE_RANGE: 0x846d;
2411 ALIASED_POINT_SIZE_RANGE: 0x846d;
2412 static ALIASED_LINE_WIDTH_RANGE: 0x846e;
2413 ALIASED_LINE_WIDTH_RANGE: 0x846e;
2414 static CULL_FACE_MODE: 0x0b45;
2415 CULL_FACE_MODE: 0x0b45;
2416 static FRONT_FACE: 0x0b46;
2417 FRONT_FACE: 0x0b46;
2418 static DEPTH_RANGE: 0x0b70;
2419 DEPTH_RANGE: 0x0b70;
2420 static DEPTH_WRITEMASK: 0x0b72;
2421 DEPTH_WRITEMASK: 0x0b72;
2422 static DEPTH_CLEAR_VALUE: 0x0b73;
2423 DEPTH_CLEAR_VALUE: 0x0b73;
2424 static DEPTH_FUNC: 0x0b74;
2425 DEPTH_FUNC: 0x0b74;
2426 static STENCIL_CLEAR_VALUE: 0x0b91;
2427 STENCIL_CLEAR_VALUE: 0x0b91;
2428 static STENCIL_FUNC: 0x0b92;
2429 STENCIL_FUNC: 0x0b92;
2430 static STENCIL_FAIL: 0x0b94;
2431 STENCIL_FAIL: 0x0b94;
2432 static STENCIL_PASS_DEPTH_FAIL: 0x0b95;
2433 STENCIL_PASS_DEPTH_FAIL: 0x0b95;
2434 static STENCIL_PASS_DEPTH_PASS: 0x0b96;
2435 STENCIL_PASS_DEPTH_PASS: 0x0b96;
2436 static STENCIL_REF: 0x0b97;
2437 STENCIL_REF: 0x0b97;
2438 static STENCIL_VALUE_MASK: 0x0b93;
2439 STENCIL_VALUE_MASK: 0x0b93;
2440 static STENCIL_WRITEMASK: 0x0b98;
2441 STENCIL_WRITEMASK: 0x0b98;
2442 static STENCIL_BACK_FUNC: 0x8800;
2443 STENCIL_BACK_FUNC: 0x8800;
2444 static STENCIL_BACK_FAIL: 0x8801;
2445 STENCIL_BACK_FAIL: 0x8801;
2446 static STENCIL_BACK_PASS_DEPTH_FAIL: 0x8802;
2447 STENCIL_BACK_PASS_DEPTH_FAIL: 0x8802;
2448 static STENCIL_BACK_PASS_DEPTH_PASS: 0x8803;
2449 STENCIL_BACK_PASS_DEPTH_PASS: 0x8803;
2450 static STENCIL_BACK_REF: 0x8ca3;
2451 STENCIL_BACK_REF: 0x8ca3;
2452 static STENCIL_BACK_VALUE_MASK: 0x8ca4;
2453 STENCIL_BACK_VALUE_MASK: 0x8ca4;
2454 static STENCIL_BACK_WRITEMASK: 0x8ca5;
2455 STENCIL_BACK_WRITEMASK: 0x8ca5;
2456 static VIEWPORT: 0x0ba2;
2457 VIEWPORT: 0x0ba2;
2458 static SCISSOR_BOX: 0x0c10;
2459 SCISSOR_BOX: 0x0c10;
2460 static COLOR_CLEAR_VALUE: 0x0c22;
2461 COLOR_CLEAR_VALUE: 0x0c22;
2462 static COLOR_WRITEMASK: 0x0c23;
2463 COLOR_WRITEMASK: 0x0c23;
2464 static UNPACK_ALIGNMENT: 0x0cf5;
2465 UNPACK_ALIGNMENT: 0x0cf5;
2466 static PACK_ALIGNMENT: 0x0d05;
2467 PACK_ALIGNMENT: 0x0d05;
2468 static MAX_TEXTURE_SIZE: 0x0d33;
2469 MAX_TEXTURE_SIZE: 0x0d33;
2470 static MAX_VIEWPORT_DIMS: 0x0d3a;
2471 MAX_VIEWPORT_DIMS: 0x0d3a;
2472 static SUBPIXEL_BITS: 0x0d50;
2473 SUBPIXEL_BITS: 0x0d50;
2474 static RED_BITS: 0x0d52;
2475 RED_BITS: 0x0d52;
2476 static GREEN_BITS: 0x0d53;
2477 GREEN_BITS: 0x0d53;
2478 static BLUE_BITS: 0x0d54;
2479 BLUE_BITS: 0x0d54;
2480 static ALPHA_BITS: 0x0d55;
2481 ALPHA_BITS: 0x0d55;
2482 static DEPTH_BITS: 0x0d56;
2483 DEPTH_BITS: 0x0d56;
2484 static STENCIL_BITS: 0x0d57;
2485 STENCIL_BITS: 0x0d57;
2486 static POLYGON_OFFSET_UNITS: 0x2a00;
2487 POLYGON_OFFSET_UNITS: 0x2a00;
2488 static POLYGON_OFFSET_FACTOR: 0x8038;
2489 POLYGON_OFFSET_FACTOR: 0x8038;
2490 static TEXTURE_BINDING_2D: 0x8069;
2491 TEXTURE_BINDING_2D: 0x8069;
2492 static SAMPLE_BUFFERS: 0x80a8;
2493 SAMPLE_BUFFERS: 0x80a8;
2494 static SAMPLES: 0x80a9;
2495 SAMPLES: 0x80a9;
2496 static SAMPLE_COVERAGE_VALUE: 0x80aa;
2497 SAMPLE_COVERAGE_VALUE: 0x80aa;
2498 static SAMPLE_COVERAGE_INVERT: 0x80ab;
2499 SAMPLE_COVERAGE_INVERT: 0x80ab;
2500 static COMPRESSED_TEXTURE_FORMATS: 0x86a3;
2501 COMPRESSED_TEXTURE_FORMATS: 0x86a3;
2502 static DONT_CARE: 0x1100;
2503 DONT_CARE: 0x1100;
2504 static FASTEST: 0x1101;
2505 FASTEST: 0x1101;
2506 static NICEST: 0x1102;
2507 NICEST: 0x1102;
2508 static GENERATE_MIPMAP_HINT: 0x8192;
2509 GENERATE_MIPMAP_HINT: 0x8192;
2510 static BYTE: 0x1400;
2511 BYTE: 0x1400;
2512 static UNSIGNED_BYTE: 0x1401;
2513 UNSIGNED_BYTE: 0x1401;
2514 static SHORT: 0x1402;
2515 SHORT: 0x1402;
2516 static UNSIGNED_SHORT: 0x1403;
2517 UNSIGNED_SHORT: 0x1403;
2518 static INT: 0x1404;
2519 INT: 0x1404;
2520 static UNSIGNED_INT: 0x1405;
2521 UNSIGNED_INT: 0x1405;
2522 static FLOAT: 0x1406;
2523 FLOAT: 0x1406;
2524 static DEPTH_COMPONENT: 0x1902;
2525 DEPTH_COMPONENT: 0x1902;
2526 static ALPHA: 0x1906;
2527 ALPHA: 0x1906;
2528 static RGB: 0x1907;
2529 RGB: 0x1907;
2530 static RGBA: 0x1908;
2531 RGBA: 0x1908;
2532 static LUMINANCE: 0x1909;
2533 LUMINANCE: 0x1909;
2534 static LUMINANCE_ALPHA: 0x190a;
2535 LUMINANCE_ALPHA: 0x190a;
2536 static UNSIGNED_SHORT_4_4_4_4: 0x8033;
2537 UNSIGNED_SHORT_4_4_4_4: 0x8033;
2538 static UNSIGNED_SHORT_5_5_5_1: 0x8034;
2539 UNSIGNED_SHORT_5_5_5_1: 0x8034;
2540 static UNSIGNED_SHORT_5_6_5: 0x8363;
2541 UNSIGNED_SHORT_5_6_5: 0x8363;
2542 static FRAGMENT_SHADER: 0x8b30;
2543 FRAGMENT_SHADER: 0x8b30;
2544 static VERTEX_SHADER: 0x8b31;
2545 VERTEX_SHADER: 0x8b31;
2546 static MAX_VERTEX_ATTRIBS: 0x8869;
2547 MAX_VERTEX_ATTRIBS: 0x8869;
2548 static MAX_VERTEX_UNIFORM_VECTORS: 0x8dfb;
2549 MAX_VERTEX_UNIFORM_VECTORS: 0x8dfb;
2550 static MAX_VARYING_VECTORS: 0x8dfc;
2551 MAX_VARYING_VECTORS: 0x8dfc;
2552 static MAX_COMBINED_TEXTURE_IMAGE_UNITS: 0x8b4d;
2553 MAX_COMBINED_TEXTURE_IMAGE_UNITS: 0x8b4d;
2554 static MAX_VERTEX_TEXTURE_IMAGE_UNITS: 0x8b4c;
2555 MAX_VERTEX_TEXTURE_IMAGE_UNITS: 0x8b4c;
2556 static MAX_TEXTURE_IMAGE_UNITS: 0x8872;
2557 MAX_TEXTURE_IMAGE_UNITS: 0x8872;
2558 static MAX_FRAGMENT_UNIFORM_VECTORS: 0x8dfd;
2559 MAX_FRAGMENT_UNIFORM_VECTORS: 0x8dfd;
2560 static SHADER_TYPE: 0x8b4f;
2561 SHADER_TYPE: 0x8b4f;
2562 static DELETE_STATUS: 0x8b80;
2563 DELETE_STATUS: 0x8b80;
2564 static LINK_STATUS: 0x8b82;
2565 LINK_STATUS: 0x8b82;
2566 static VALIDATE_STATUS: 0x8b83;
2567 VALIDATE_STATUS: 0x8b83;
2568 static ATTACHED_SHADERS: 0x8b85;
2569 ATTACHED_SHADERS: 0x8b85;
2570 static ACTIVE_UNIFORMS: 0x8b86;
2571 ACTIVE_UNIFORMS: 0x8b86;
2572 static ACTIVE_ATTRIBUTES: 0x8b89;
2573 ACTIVE_ATTRIBUTES: 0x8b89;
2574 static SHADING_LANGUAGE_VERSION: 0x8b8c;
2575 SHADING_LANGUAGE_VERSION: 0x8b8c;
2576 static CURRENT_PROGRAM: 0x8b8d;
2577 CURRENT_PROGRAM: 0x8b8d;
2578 static NEVER: 0x0200;
2579 NEVER: 0x0200;
2580 static LESS: 0x0201;
2581 LESS: 0x0201;
2582 static EQUAL: 0x0202;
2583 EQUAL: 0x0202;
2584 static LEQUAL: 0x0203;
2585 LEQUAL: 0x0203;
2586 static GREATER: 0x0204;
2587 GREATER: 0x0204;
2588 static NOTEQUAL: 0x0205;
2589 NOTEQUAL: 0x0205;
2590 static GEQUAL: 0x0206;
2591 GEQUAL: 0x0206;
2592 static ALWAYS: 0x0207;
2593 ALWAYS: 0x0207;
2594 static KEEP: 0x1e00;
2595 KEEP: 0x1e00;
2596 static REPLACE: 0x1e01;
2597 REPLACE: 0x1e01;
2598 static INCR: 0x1e02;
2599 INCR: 0x1e02;
2600 static DECR: 0x1e03;
2601 DECR: 0x1e03;
2602 static INVERT: 0x150a;
2603 INVERT: 0x150a;
2604 static INCR_WRAP: 0x8507;
2605 INCR_WRAP: 0x8507;
2606 static DECR_WRAP: 0x8508;
2607 DECR_WRAP: 0x8508;
2608 static VENDOR: 0x1f00;
2609 VENDOR: 0x1f00;
2610 static RENDERER: 0x1f01;
2611 RENDERER: 0x1f01;
2612 static VERSION: 0x1f02;
2613 VERSION: 0x1f02;
2614 static NEAREST: 0x2600;
2615 NEAREST: 0x2600;
2616 static LINEAR: 0x2601;
2617 LINEAR: 0x2601;
2618 static NEAREST_MIPMAP_NEAREST: 0x2700;
2619 NEAREST_MIPMAP_NEAREST: 0x2700;
2620 static LINEAR_MIPMAP_NEAREST: 0x2701;
2621 LINEAR_MIPMAP_NEAREST: 0x2701;
2622 static NEAREST_MIPMAP_LINEAR: 0x2702;
2623 NEAREST_MIPMAP_LINEAR: 0x2702;
2624 static LINEAR_MIPMAP_LINEAR: 0x2703;
2625 LINEAR_MIPMAP_LINEAR: 0x2703;
2626 static TEXTURE_MAG_FILTER: 0x2800;
2627 TEXTURE_MAG_FILTER: 0x2800;
2628 static TEXTURE_MIN_FILTER: 0x2801;
2629 TEXTURE_MIN_FILTER: 0x2801;
2630 static TEXTURE_WRAP_S: 0x2802;
2631 TEXTURE_WRAP_S: 0x2802;
2632 static TEXTURE_WRAP_T: 0x2803;
2633 TEXTURE_WRAP_T: 0x2803;
2634 static TEXTURE_2D: 0x0de1;
2635 TEXTURE_2D: 0x0de1;
2636 static TEXTURE: 0x1702;
2637 TEXTURE: 0x1702;
2638 static TEXTURE_CUBE_MAP: 0x8513;
2639 TEXTURE_CUBE_MAP: 0x8513;
2640 static TEXTURE_BINDING_CUBE_MAP: 0x8514;
2641 TEXTURE_BINDING_CUBE_MAP: 0x8514;
2642 static TEXTURE_CUBE_MAP_POSITIVE_X: 0x8515;
2643 TEXTURE_CUBE_MAP_POSITIVE_X: 0x8515;
2644 static TEXTURE_CUBE_MAP_NEGATIVE_X: 0x8516;
2645 TEXTURE_CUBE_MAP_NEGATIVE_X: 0x8516;
2646 static TEXTURE_CUBE_MAP_POSITIVE_Y: 0x8517;
2647 TEXTURE_CUBE_MAP_POSITIVE_Y: 0x8517;
2648 static TEXTURE_CUBE_MAP_NEGATIVE_Y: 0x8518;
2649 TEXTURE_CUBE_MAP_NEGATIVE_Y: 0x8518;
2650 static TEXTURE_CUBE_MAP_POSITIVE_Z: 0x8519;
2651 TEXTURE_CUBE_MAP_POSITIVE_Z: 0x8519;
2652 static TEXTURE_CUBE_MAP_NEGATIVE_Z: 0x851a;
2653 TEXTURE_CUBE_MAP_NEGATIVE_Z: 0x851a;
2654 static MAX_CUBE_MAP_TEXTURE_SIZE: 0x851c;
2655 MAX_CUBE_MAP_TEXTURE_SIZE: 0x851c;
2656 static TEXTURE0: 0x84c0;
2657 TEXTURE0: 0x84c0;
2658 static TEXTURE1: 0x84c1;
2659 TEXTURE1: 0x84c1;
2660 static TEXTURE2: 0x84c2;
2661 TEXTURE2: 0x84c2;
2662 static TEXTURE3: 0x84c3;
2663 TEXTURE3: 0x84c3;
2664 static TEXTURE4: 0x84c4;
2665 TEXTURE4: 0x84c4;
2666 static TEXTURE5: 0x84c5;
2667 TEXTURE5: 0x84c5;
2668 static TEXTURE6: 0x84c6;
2669 TEXTURE6: 0x84c6;
2670 static TEXTURE7: 0x84c7;
2671 TEXTURE7: 0x84c7;
2672 static TEXTURE8: 0x84c8;
2673 TEXTURE8: 0x84c8;
2674 static TEXTURE9: 0x84c9;
2675 TEXTURE9: 0x84c9;
2676 static TEXTURE10: 0x84ca;
2677 TEXTURE10: 0x84ca;
2678 static TEXTURE11: 0x84cb;
2679 TEXTURE11: 0x84cb;
2680 static TEXTURE12: 0x84cc;
2681 TEXTURE12: 0x84cc;
2682 static TEXTURE13: 0x84cd;
2683 TEXTURE13: 0x84cd;
2684 static TEXTURE14: 0x84ce;
2685 TEXTURE14: 0x84ce;
2686 static TEXTURE15: 0x84cf;
2687 TEXTURE15: 0x84cf;
2688 static TEXTURE16: 0x84d0;
2689 TEXTURE16: 0x84d0;
2690 static TEXTURE17: 0x84d1;
2691 TEXTURE17: 0x84d1;
2692 static TEXTURE18: 0x84d2;
2693 TEXTURE18: 0x84d2;
2694 static TEXTURE19: 0x84d3;
2695 TEXTURE19: 0x84d3;
2696 static TEXTURE20: 0x84d4;
2697 TEXTURE20: 0x84d4;
2698 static TEXTURE21: 0x84d5;
2699 TEXTURE21: 0x84d5;
2700 static TEXTURE22: 0x84d6;
2701 TEXTURE22: 0x84d6;
2702 static TEXTURE23: 0x84d7;
2703 TEXTURE23: 0x84d7;
2704 static TEXTURE24: 0x84d8;
2705 TEXTURE24: 0x84d8;
2706 static TEXTURE25: 0x84d9;
2707 TEXTURE25: 0x84d9;
2708 static TEXTURE26: 0x84da;
2709 TEXTURE26: 0x84da;
2710 static TEXTURE27: 0x84db;
2711 TEXTURE27: 0x84db;
2712 static TEXTURE28: 0x84dc;
2713 TEXTURE28: 0x84dc;
2714 static TEXTURE29: 0x84dd;
2715 TEXTURE29: 0x84dd;
2716 static TEXTURE30: 0x84de;
2717 TEXTURE30: 0x84de;
2718 static TEXTURE31: 0x84df;
2719 TEXTURE31: 0x84df;
2720 static ACTIVE_TEXTURE: 0x84e0;
2721 ACTIVE_TEXTURE: 0x84e0;
2722 static REPEAT: 0x2901;
2723 REPEAT: 0x2901;
2724 static CLAMP_TO_EDGE: 0x812f;
2725 CLAMP_TO_EDGE: 0x812f;
2726 static MIRRORED_REPEAT: 0x8370;
2727 MIRRORED_REPEAT: 0x8370;
2728 static FLOAT_VEC2: 0x8b50;
2729 FLOAT_VEC2: 0x8b50;
2730 static FLOAT_VEC3: 0x8b51;
2731 FLOAT_VEC3: 0x8b51;
2732 static FLOAT_VEC4: 0x8b52;
2733 FLOAT_VEC4: 0x8b52;
2734 static INT_VEC2: 0x8b53;
2735 INT_VEC2: 0x8b53;
2736 static INT_VEC3: 0x8b54;
2737 INT_VEC3: 0x8b54;
2738 static INT_VEC4: 0x8b55;
2739 INT_VEC4: 0x8b55;
2740 static BOOL: 0x8b56;
2741 BOOL: 0x8b56;
2742 static BOOL_VEC2: 0x8b57;
2743 BOOL_VEC2: 0x8b57;
2744 static BOOL_VEC3: 0x8b58;
2745 BOOL_VEC3: 0x8b58;
2746 static BOOL_VEC4: 0x8b59;
2747 BOOL_VEC4: 0x8b59;
2748 static FLOAT_MAT2: 0x8b5a;
2749 FLOAT_MAT2: 0x8b5a;
2750 static FLOAT_MAT3: 0x8b5b;
2751 FLOAT_MAT3: 0x8b5b;
2752 static FLOAT_MAT4: 0x8b5c;
2753 FLOAT_MAT4: 0x8b5c;
2754 static SAMPLER_2D: 0x8b5e;
2755 SAMPLER_2D: 0x8b5e;
2756 static SAMPLER_CUBE: 0x8b60;
2757 SAMPLER_CUBE: 0x8b60;
2758 static VERTEX_ATTRIB_ARRAY_ENABLED: 0x8622;
2759 VERTEX_ATTRIB_ARRAY_ENABLED: 0x8622;
2760 static VERTEX_ATTRIB_ARRAY_SIZE: 0x8623;
2761 VERTEX_ATTRIB_ARRAY_SIZE: 0x8623;
2762 static VERTEX_ATTRIB_ARRAY_STRIDE: 0x8624;
2763 VERTEX_ATTRIB_ARRAY_STRIDE: 0x8624;
2764 static VERTEX_ATTRIB_ARRAY_TYPE: 0x8625;
2765 VERTEX_ATTRIB_ARRAY_TYPE: 0x8625;
2766 static VERTEX_ATTRIB_ARRAY_NORMALIZED: 0x886a;
2767 VERTEX_ATTRIB_ARRAY_NORMALIZED: 0x886a;
2768 static VERTEX_ATTRIB_ARRAY_POINTER: 0x8645;
2769 VERTEX_ATTRIB_ARRAY_POINTER: 0x8645;
2770 static VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 0x889f;
2771 VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 0x889f;
2772 static IMPLEMENTATION_COLOR_READ_TYPE: 0x8b9a;
2773 IMPLEMENTATION_COLOR_READ_TYPE: 0x8b9a;
2774 static IMPLEMENTATION_COLOR_READ_FORMAT: 0x8b9b;
2775 IMPLEMENTATION_COLOR_READ_FORMAT: 0x8b9b;
2776 static COMPILE_STATUS: 0x8b81;
2777 COMPILE_STATUS: 0x8b81;
2778 static LOW_FLOAT: 0x8df0;
2779 LOW_FLOAT: 0x8df0;
2780 static MEDIUM_FLOAT: 0x8df1;
2781 MEDIUM_FLOAT: 0x8df1;
2782 static HIGH_FLOAT: 0x8df2;
2783 HIGH_FLOAT: 0x8df2;
2784 static LOW_INT: 0x8df3;
2785 LOW_INT: 0x8df3;
2786 static MEDIUM_INT: 0x8df4;
2787 MEDIUM_INT: 0x8df4;
2788 static HIGH_INT: 0x8df5;
2789 HIGH_INT: 0x8df5;
2790 static FRAMEBUFFER: 0x8d40;
2791 FRAMEBUFFER: 0x8d40;
2792 static RENDERBUFFER: 0x8d41;
2793 RENDERBUFFER: 0x8d41;
2794 static RGBA4: 0x8056;
2795 RGBA4: 0x8056;
2796 static RGB5_A1: 0x8057;
2797 RGB5_A1: 0x8057;
2798 static RGB565: 0x8d62;
2799 RGB565: 0x8d62;
2800 static DEPTH_COMPONENT16: 0x81a5;
2801 DEPTH_COMPONENT16: 0x81a5;
2802 static STENCIL_INDEX: 0x1901;
2803 STENCIL_INDEX: 0x1901;
2804 static STENCIL_INDEX8: 0x8d48;
2805 STENCIL_INDEX8: 0x8d48;
2806 static DEPTH_STENCIL: 0x84f9;
2807 DEPTH_STENCIL: 0x84f9;
2808 static RENDERBUFFER_WIDTH: 0x8d42;
2809 RENDERBUFFER_WIDTH: 0x8d42;
2810 static RENDERBUFFER_HEIGHT: 0x8d43;
2811 RENDERBUFFER_HEIGHT: 0x8d43;
2812 static RENDERBUFFER_INTERNAL_FORMAT: 0x8d44;
2813 RENDERBUFFER_INTERNAL_FORMAT: 0x8d44;
2814 static RENDERBUFFER_RED_SIZE: 0x8d50;
2815 RENDERBUFFER_RED_SIZE: 0x8d50;
2816 static RENDERBUFFER_GREEN_SIZE: 0x8d51;
2817 RENDERBUFFER_GREEN_SIZE: 0x8d51;
2818 static RENDERBUFFER_BLUE_SIZE: 0x8d52;
2819 RENDERBUFFER_BLUE_SIZE: 0x8d52;
2820 static RENDERBUFFER_ALPHA_SIZE: 0x8d53;
2821 RENDERBUFFER_ALPHA_SIZE: 0x8d53;
2822 static RENDERBUFFER_DEPTH_SIZE: 0x8d54;
2823 RENDERBUFFER_DEPTH_SIZE: 0x8d54;
2824 static RENDERBUFFER_STENCIL_SIZE: 0x8d55;
2825 RENDERBUFFER_STENCIL_SIZE: 0x8d55;
2826 static FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 0x8cd0;
2827 FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 0x8cd0;
2828 static FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 0x8cd1;
2829 FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 0x8cd1;
2830 static FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 0x8cd2;
2831 FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 0x8cd2;
2832 static FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 0x8cd3;
2833 FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 0x8cd3;
2834 static COLOR_ATTACHMENT0: 0x8ce0;
2835 COLOR_ATTACHMENT0: 0x8ce0;
2836 static DEPTH_ATTACHMENT: 0x8d00;
2837 DEPTH_ATTACHMENT: 0x8d00;
2838 static STENCIL_ATTACHMENT: 0x8d20;
2839 STENCIL_ATTACHMENT: 0x8d20;
2840 static DEPTH_STENCIL_ATTACHMENT: 0x821a;
2841 DEPTH_STENCIL_ATTACHMENT: 0x821a;
2842 static NONE: 0;
2843 NONE: 0;
2844 static FRAMEBUFFER_COMPLETE: 0x8cd5;
2845 FRAMEBUFFER_COMPLETE: 0x8cd5;
2846 static FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 0x8cd6;
2847 FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 0x8cd6;
2848 static FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 0x8cd7;
2849 FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 0x8cd7;
2850 static FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 0x8cd9;
2851 FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 0x8cd9;
2852 static FRAMEBUFFER_UNSUPPORTED: 0x8cdd;
2853 FRAMEBUFFER_UNSUPPORTED: 0x8cdd;
2854 static FRAMEBUFFER_BINDING: 0x8ca6;
2855 FRAMEBUFFER_BINDING: 0x8ca6;
2856 static RENDERBUFFER_BINDING: 0x8ca7;
2857 RENDERBUFFER_BINDING: 0x8ca7;
2858 static MAX_RENDERBUFFER_SIZE: 0x84e8;
2859 MAX_RENDERBUFFER_SIZE: 0x84e8;
2860 static INVALID_FRAMEBUFFER_OPERATION: 0x0506;
2861 INVALID_FRAMEBUFFER_OPERATION: 0x0506;
2862 static UNPACK_FLIP_Y_WEBGL: 0x9240;
2863 UNPACK_FLIP_Y_WEBGL: 0x9240;
2864 static UNPACK_PREMULTIPLY_ALPHA_WEBGL: 0x9241;
2865 UNPACK_PREMULTIPLY_ALPHA_WEBGL: 0x9241;
2866 static CONTEXT_LOST_WEBGL: 0x9242;
2867 CONTEXT_LOST_WEBGL: 0x9242;
2868 static UNPACK_COLORSPACE_CONVERSION_WEBGL: 0x9243;
2869 UNPACK_COLORSPACE_CONVERSION_WEBGL: 0x9243;
2870 static BROWSER_DEFAULT_WEBGL: 0x9244;
2871 BROWSER_DEFAULT_WEBGL: 0x9244;
2872
2873 canvas: HTMLCanvasElement;
2874 drawingBufferWidth: number;
2875 drawingBufferHeight: number;
2876
2877 getContextAttributes(): ?WebGLContextAttributes;
2878 isContextLost(): boolean;
2879
2880 getSupportedExtensions(): ?Array<string>;
2881 getExtension(name: string): any;
2882
2883 activeTexture(texture: number): void;
2884 attachShader(program: WebGLProgram, shader: WebGLShader): void;
2885 bindAttribLocation(program: WebGLProgram, index: number, name: string): void;
2886 bindBuffer(target: number, buffer: ?WebGLBuffer): void;
2887 bindFramebuffer(target: number, framebuffer: ?WebGLFramebuffer): void;
2888 bindRenderbuffer(target: number, renderbuffer: ?WebGLRenderbuffer): void;
2889 bindTexture(target: number, texture: ?WebGLTexture): void;
2890 blendColor(red: number, green: number, blue: number, alpha: number): void;
2891 blendEquation(mode: number): void;
2892 blendEquationSeparate(modeRGB: number, modeAlpha: number): void;
2893 blendFunc(sfactor: number, dfactor: number): void;
2894 blendFuncSeparate(
2895 srcRGB: number,
2896 dstRGB: number,
2897 srcAlpha: number,
2898 dstAlpha: number
2899 ): void;
2900
2901 bufferData(target: number, size: number, usage: number): void;
2902 bufferData(target: number, data: ?ArrayBuffer, usage: number): void;
2903 bufferData(target: number, data: $ArrayBufferView, usage: number): void;
2904 bufferSubData(target: number, offset: number, data: BufferDataSource): void;
2905
2906 checkFramebufferStatus(target: number): number;
2907 clear(mask: number): void;
2908 clearColor(red: number, green: number, blue: number, alpha: number): void;
2909 clearDepth(depth: number): void;
2910 clearStencil(s: number): void;
2911 colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void;
2912 compileShader(shader: WebGLShader): void;
2913
2914 compressedTexImage2D(
2915 target: number,
2916 level: number,
2917 internalformat: number,
2918 width: number,
2919 height: number,
2920 border: number,
2921 data: $ArrayBufferView
2922 ): void;
2923
2924 compressedTexSubImage2D(
2925 target: number,
2926 level: number,
2927 xoffset: number,
2928 yoffset: number,
2929 width: number,
2930 height: number,
2931 format: number,
2932 data: $ArrayBufferView
2933 ): void;
2934
2935 copyTexImage2D(
2936 target: number,
2937 level: number,
2938 internalformat: number,
2939 x: number,
2940 y: number,
2941 width: number,
2942 height: number,
2943 border: number
2944 ): void;
2945 copyTexSubImage2D(
2946 target: number,
2947 level: number,
2948 xoffset: number,
2949 yoffset: number,
2950 x: number,
2951 y: number,
2952 width: number,
2953 height: number
2954 ): void;
2955
2956 createBuffer(): ?WebGLBuffer;
2957 createFramebuffer(): ?WebGLFramebuffer;
2958 createProgram(): ?WebGLProgram;
2959 createRenderbuffer(): ?WebGLRenderbuffer;
2960 createShader(type: number): ?WebGLShader;
2961 createTexture(): ?WebGLTexture;
2962
2963 cullFace(mode: number): void;
2964
2965 deleteBuffer(buffer: ?WebGLBuffer): void;
2966 deleteFramebuffer(framebuffer: ?WebGLFramebuffer): void;
2967 deleteProgram(program: ?WebGLProgram): void;
2968 deleteRenderbuffer(renderbuffer: ?WebGLRenderbuffer): void;
2969 deleteShader(shader: ?WebGLShader): void;
2970 deleteTexture(texture: ?WebGLTexture): void;
2971
2972 depthFunc(func: number): void;
2973 depthMask(flag: boolean): void;
2974 depthRange(zNear: number, zFar: number): void;
2975 detachShader(program: WebGLProgram, shader: WebGLShader): void;
2976 disable(cap: number): void;
2977 disableVertexAttribArray(index: number): void;
2978 drawArrays(mode: number, first: number, count: number): void;
2979 drawElements(mode: number, count: number, type: number, offset: number): void;
2980
2981 enable(cap: number): void;
2982 enableVertexAttribArray(index: number): void;
2983 finish(): void;
2984 flush(): void;
2985 framebufferRenderbuffer(
2986 target: number,
2987 attachment: number,
2988 renderbuffertarget: number,
2989 renderbuffer: ?WebGLRenderbuffer
2990 ): void;
2991 framebufferTexture2D(
2992 target: number,
2993 attachment: number,
2994 textarget: number,
2995 texture: ?WebGLTexture,
2996 level: number
2997 ): void;
2998 frontFace(mode: number): void;
2999
3000 generateMipmap(target: number): void;
3001
3002 getActiveAttrib(program: WebGLProgram, index: number): ?WebGLActiveInfo;
3003 getActiveUniform(program: WebGLProgram, index: number): ?WebGLActiveInfo;
3004 getAttachedShaders(program: WebGLProgram): ?Array<WebGLShader>;
3005
3006 getAttribLocation(program: WebGLProgram, name: string): number;
3007
3008 getBufferParameter(target: number, pname: number): any;
3009 getParameter(pname: number): any;
3010
3011 getError(): number;
3012
3013 getFramebufferAttachmentParameter(
3014 target: number,
3015 attachment: number,
3016 pname: number
3017 ): any;
3018 getProgramParameter(program: WebGLProgram, pname: number): any;
3019 getProgramInfoLog(program: WebGLProgram): ?string;
3020 getRenderbufferParameter(target: number, pname: number): any;
3021 getShaderParameter(shader: WebGLShader, pname: number): any;
3022 getShaderPrecisionFormat(
3023 shadertype: number,
3024 precisiontype: number
3025 ): ?WebGLShaderPrecisionFormat;
3026 getShaderInfoLog(shader: WebGLShader): ?string;
3027
3028 getShaderSource(shader: WebGLShader): ?string;
3029
3030 getTexParameter(target: number, pname: number): any;
3031
3032 getUniform(program: WebGLProgram, location: WebGLUniformLocation): any;
3033
3034 getUniformLocation(
3035 program: WebGLProgram,
3036 name: string
3037 ): ?WebGLUniformLocation;
3038
3039 getVertexAttrib(index: number, pname: number): any;
3040
3041 getVertexAttribOffset(index: number, pname: number): number;
3042
3043 hint(target: number, mode: number): void;
3044 isBuffer(buffer: ?WebGLBuffer): boolean;
3045 isEnabled(cap: number): boolean;
3046 isFramebuffer(framebuffer: ?WebGLFramebuffer): boolean;
3047 isProgram(program: ?WebGLProgram): boolean;
3048 isRenderbuffer(renderbuffer: ?WebGLRenderbuffer): boolean;
3049 isShader(shader: ?WebGLShader): boolean;
3050 isTexture(texture: ?WebGLTexture): boolean;
3051 lineWidth(width: number): void;
3052 linkProgram(program: WebGLProgram): void;
3053 pixelStorei(pname: number, param: number): void;
3054 polygonOffset(factor: number, units: number): void;
3055
3056 readPixels(
3057 x: number,
3058 y: number,
3059 width: number,
3060 height: number,
3061 format: number,
3062 type: number,
3063 pixels: ?$ArrayBufferView
3064 ): void;
3065
3066 renderbufferStorage(
3067 target: number,
3068 internalformat: number,
3069 width: number,
3070 height: number
3071 ): void;
3072 sampleCoverage(value: number, invert: boolean): void;
3073 scissor(x: number, y: number, width: number, height: number): void;
3074
3075 shaderSource(shader: WebGLShader, source: string): void;
3076
3077 stencilFunc(func: number, ref: number, mask: number): void;
3078 stencilFuncSeparate(
3079 face: number,
3080 func: number,
3081 ref: number,
3082 mask: number
3083 ): void;
3084 stencilMask(mask: number): void;
3085 stencilMaskSeparate(face: number, mask: number): void;
3086 stencilOp(fail: number, zfail: number, zpass: number): void;
3087 stencilOpSeparate(
3088 face: number,
3089 fail: number,
3090 zfail: number,
3091 zpass: number
3092 ): void;
3093
3094 texImage2D(
3095 target: number,
3096 level: number,
3097 internalformat: number,
3098 width: number,
3099 height: number,
3100 border: number,
3101 format: number,
3102 type: number,
3103 pixels: ?$ArrayBufferView
3104 ): void;
3105 texImage2D(
3106 target: number,
3107 level: number,
3108 internalformat: number,
3109 format: number,
3110 type: number,
3111 source: TexImageSource
3112 ): void;
3113
3114 texParameterf(target: number, pname: number, param: number): void;
3115 texParameteri(target: number, pname: number, param: number): void;
3116
3117 texSubImage2D(
3118 target: number,
3119 level: number,
3120 xoffset: number,
3121 yoffset: number,
3122 width: number,
3123 height: number,
3124 format: number,
3125 type: number,
3126 pixels: ?$ArrayBufferView
3127 ): void;
3128 texSubImage2D(
3129 target: number,
3130 level: number,
3131 xoffset: number,
3132 yoffset: number,
3133 format: number,
3134 type: number,
3135 source: TexImageSource
3136 ): void;
3137
3138 uniform1f(location: ?WebGLUniformLocation, x: number): void;
3139 uniform1fv(location: ?WebGLUniformLocation, v: Float32Array): void;
3140 uniform1fv(location: ?WebGLUniformLocation, v: Array<number>): void;
3141 uniform1fv(location: ?WebGLUniformLocation, v: [number]): void;
3142 uniform1i(location: ?WebGLUniformLocation, x: number): void;
3143 uniform1iv(location: ?WebGLUniformLocation, v: Int32Array): void;
3144 uniform1iv(location: ?WebGLUniformLocation, v: Array<number>): void;
3145 uniform1iv(location: ?WebGLUniformLocation, v: [number]): void;
3146 uniform2f(location: ?WebGLUniformLocation, x: number, y: number): void;
3147 uniform2fv(location: ?WebGLUniformLocation, v: Float32Array): void;
3148 uniform2fv(location: ?WebGLUniformLocation, v: Array<number>): void;
3149 uniform2fv(location: ?WebGLUniformLocation, v: [number, number]): void;
3150 uniform2i(location: ?WebGLUniformLocation, x: number, y: number): void;
3151 uniform2iv(location: ?WebGLUniformLocation, v: Int32Array): void;
3152 uniform2iv(location: ?WebGLUniformLocation, v: Array<number>): void;
3153 uniform2iv(location: ?WebGLUniformLocation, v: [number, number]): void;
3154 uniform3f(
3155 location: ?WebGLUniformLocation,
3156 x: number,
3157 y: number,
3158 z: number
3159 ): void;
3160 uniform3fv(location: ?WebGLUniformLocation, v: Float32Array): void;
3161 uniform3fv(location: ?WebGLUniformLocation, v: Array<number>): void;
3162 uniform3fv(
3163 location: ?WebGLUniformLocation,
3164 v: [number, number, number]
3165 ): void;
3166 uniform3i(
3167 location: ?WebGLUniformLocation,
3168 x: number,
3169 y: number,
3170 z: number
3171 ): void;
3172 uniform3iv(location: ?WebGLUniformLocation, v: Int32Array): void;
3173 uniform3iv(location: ?WebGLUniformLocation, v: Array<number>): void;
3174 uniform3iv(
3175 location: ?WebGLUniformLocation,
3176 v: [number, number, number]
3177 ): void;
3178 uniform4f(
3179 location: ?WebGLUniformLocation,
3180 x: number,
3181 y: number,
3182 z: number,
3183 w: number
3184 ): void;
3185 uniform4fv(location: ?WebGLUniformLocation, v: Float32Array): void;
3186 uniform4fv(location: ?WebGLUniformLocation, v: Array<number>): void;
3187 uniform4fv(
3188 location: ?WebGLUniformLocation,
3189 v: [number, number, number, number]
3190 ): void;
3191 uniform4i(
3192 location: ?WebGLUniformLocation,
3193 x: number,
3194 y: number,
3195 z: number,
3196 w: number
3197 ): void;
3198 uniform4iv(location: ?WebGLUniformLocation, v: Int32Array): void;
3199 uniform4iv(location: ?WebGLUniformLocation, v: Array<number>): void;
3200 uniform4iv(
3201 location: ?WebGLUniformLocation,
3202 v: [number, number, number, number]
3203 ): void;
3204
3205 uniformMatrix2fv(
3206 location: ?WebGLUniformLocation,
3207 transpose: boolean,
3208 value: Float32Array
3209 ): void;
3210 uniformMatrix2fv(
3211 location: ?WebGLUniformLocation,
3212 transpose: boolean,
3213 value: Array<number>
3214 ): void;
3215 uniformMatrix3fv(
3216 location: ?WebGLUniformLocation,
3217 transpose: boolean,
3218 value: Float32Array
3219 ): void;
3220 uniformMatrix3fv(
3221 location: ?WebGLUniformLocation,
3222 transpose: boolean,
3223 value: Array<number>
3224 ): void;
3225 uniformMatrix4fv(
3226 location: ?WebGLUniformLocation,
3227 transpose: boolean,
3228 value: Float32Array
3229 ): void;
3230 uniformMatrix4fv(
3231 location: ?WebGLUniformLocation,
3232 transpose: boolean,
3233 value: Array<number>
3234 ): void;
3235
3236 useProgram(program: ?WebGLProgram): void;
3237 validateProgram(program: WebGLProgram): void;
3238
3239 vertexAttrib1f(index: number, x: number): void;
3240 vertexAttrib1fv(index: number, values: VertexAttribFVSource): void;
3241 vertexAttrib2f(index: number, x: number, y: number): void;
3242 vertexAttrib2fv(index: number, values: VertexAttribFVSource): void;
3243 vertexAttrib3f(index: number, x: number, y: number, z: number): void;
3244 vertexAttrib3fv(index: number, values: VertexAttribFVSource): void;
3245 vertexAttrib4f(
3246 index: number,
3247 x: number,
3248 y: number,
3249 z: number,
3250 w: number
3251 ): void;
3252 vertexAttrib4fv(index: number, values: VertexAttribFVSource): void;
3253 vertexAttribPointer(
3254 index: number,
3255 size: number,
3256 type: number,
3257 normalized: boolean,
3258 stride: number,
3259 offset: number
3260 ): void;
3261
3262 viewport(x: number, y: number, width: number, height: number): void;
3263 }
3264
3265 declare class WebGLContextEvent extends Event {
3266 statusMessage: string;
3267 }
3268
3269 declare class MediaKeyStatusMap<BufferDataSource, MediaKeyStatus> {
3270 @@iterator(): Iterator<[BufferDataSource, MediaKeyStatus]>;
3271 size: number;
3272 entries(): Iterator<[BufferDataSource, MediaKeyStatus]>;
3273 forEach(
3274 callbackfn: (
3275 value: MediaKeyStatus,
3276 key: BufferDataSource,
3277 map: MediaKeyStatusMap<BufferDataSource, MediaKeyStatus>
3278 ) => any,
3279 thisArg?: any
3280 ): void;
3281 get(key: BufferDataSource): MediaKeyStatus;
3282 has(key: BufferDataSource): boolean;
3283 keys(): Iterator<BufferDataSource>;
3284 values(): Iterator<MediaKeyStatus>;
3285 }
3286
3287 declare class MediaKeySession extends EventTarget {
3288 sessionId: string;
3289 expiration: number;
3290 closed: Promise<void>;
3291 keyStatuses: MediaKeyStatusMap<BufferDataSource, MediaKeyStatus>;
3292
3293 generateRequest(
3294 initDataType: string,
3295 initData: BufferDataSource
3296 ): Promise<void>;
3297 load(sessionId: string): Promise<boolean>;
3298 update(response: BufferDataSource): Promise<void>;
3299 close(): Promise<void>;
3300 remove(): Promise<void>;
3301
3302 onkeystatuschange: (ev: any) => any;
3303 onmessage: (ev: any) => any;
3304 }
3305
3306 declare class MediaKeys {
3307 createSession(mediaKeySessionType: MediaKeySessionType): MediaKeySession;
3308 setServerCertificate(serverCertificate: BufferDataSource): Promise<boolean>;
3309 }
3310
3311 declare class TextRange {
3312 boundingLeft: number;
3313 htmlText: string;
3314 offsetLeft: number;
3315 boundingWidth: number;
3316 boundingHeight: number;
3317 boundingTop: number;
3318 text: string;
3319 offsetTop: number;
3320 moveToPoint(x: number, y: number): void;
3321 queryCommandValue(cmdID: string): any;
3322 getBookmark(): string;
3323 move(unit: string, count?: number): number;
3324 queryCommandIndeterm(cmdID: string): boolean;
3325 scrollIntoView(fStart?: boolean): void;
3326 findText(string: string, count?: number, flags?: number): boolean;
3327 execCommand(cmdID: string, showUI?: boolean, value?: any): boolean;
3328 getBoundingClientRect(): DOMRect;
3329 moveToBookmark(bookmark: string): boolean;
3330 isEqual(range: TextRange): boolean;
3331 duplicate(): TextRange;
3332 collapse(start?: boolean): void;
3333 queryCommandText(cmdID: string): string;
3334 select(): void;
3335 pasteHTML(html: string): void;
3336 inRange(range: TextRange): boolean;
3337 moveEnd(unit: string, count?: number): number;
3338 getClientRects(): DOMRectList;
3339 moveStart(unit: string, count?: number): number;
3340 parentElement(): Element;
3341 queryCommandState(cmdID: string): boolean;
3342 compareEndPoints(how: string, sourceRange: TextRange): number;
3343 execCommandShowHelp(cmdID: string): boolean;
3344 moveToElementText(element: Element): void;
3345 expand(Unit: string): boolean;
3346 queryCommandSupported(cmdID: string): boolean;
3347 setEndPoint(how: string, SourceRange: TextRange): void;
3348 queryCommandEnabled(cmdID: string): boolean;
3349 }
3350
3351 // These types used to exist as a copy of DOMRect/DOMRectList, which is
3352 // incorrect because there are no ClientRect/ClientRectList globals on the DOM.
3353 // Keep these as type aliases for backwards compatibility.
3354 declare type ClientRect = DOMRect;
3355 declare type ClientRectList = DOMRectList;
3356
3357 // TODO: HTML*Element
3358
3359 declare class DOMImplementation {
3360 createDocumentType(
3361 qualifiedName: string,
3362 publicId: string,
3363 systemId: string
3364 ): DocumentType;
3365 createDocument(
3366 namespaceURI: string | null,
3367 qualifiedName: string,
3368 doctype?: DocumentType | null
3369 ): Document;
3370 hasFeature(feature: string, version?: string): boolean;
3371
3372 // non-standard
3373 createHTMLDocument(title?: string): Document;
3374 }
3375
3376 declare class DocumentType extends Node {
3377 name: string;
3378 notations: NamedNodeMap;
3379 systemId: string;
3380 internalSubset: string;
3381 entities: NamedNodeMap;
3382 publicId: string;
3383
3384 // from ChildNode interface
3385 after(...nodes: Array<string | Node>): void;
3386 before(...nodes: Array<string | Node>): void;
3387 replaceWith(...nodes: Array<string | Node>): void;
3388 remove(): void;
3389 }
3390
3391 declare class CharacterData extends Node {
3392 length: number;
3393 data: string;
3394 deleteData(offset: number, count: number): void;
3395 replaceData(offset: number, count: number, arg: string): void;
3396 appendData(arg: string): void;
3397 insertData(offset: number, arg: string): void;
3398 substringData(offset: number, count: number): string;
3399
3400 // from ChildNode interface
3401 after(...nodes: Array<string | Node>): void;
3402 before(...nodes: Array<string | Node>): void;
3403 replaceWith(...nodes: Array<string | Node>): void;
3404 remove(): void;
3405 }
3406
3407 declare class Text extends CharacterData {
3408 assignedSlot?: HTMLSlotElement;
3409 wholeText: string;
3410 splitText(offset: number): Text;
3411 replaceWholeText(content: string): Text;
3412 }
3413
3414 declare class Comment extends CharacterData {
3415 text: string;
3416 }
3417
3418 declare class URL {
3419 static canParse(url: string, base?: string): boolean;
3420 static createObjectURL(blob: Blob): string;
3421 static createObjectURL(mediaSource: MediaSource): string;
3422 static revokeObjectURL(url: string): void;
3423 static parse(url: string, base?: string): URL | null;
3424 constructor(url: string, base?: string | URL): void;
3425 hash: string;
3426 host: string;
3427 hostname: string;
3428 href: string;
3429 +origin: string;
3430 password: string;
3431 pathname: string;
3432 port: string;
3433 protocol: string;
3434 search: string;
3435 +searchParams: URLSearchParams;
3436 username: string;
3437 toString(): string;
3438 toJSON(): string;
3439 }
3440
3441 declare interface MediaSourceHandle {}
3442
3443 declare class MediaSource extends EventTarget {
3444 sourceBuffers: SourceBufferList;
3445 activeSourceBuffers: SourceBufferList;
3446 // https://w3c.github.io/media-source/#dom-readystate
3447 readyState: 'closed' | 'open' | 'ended';
3448 duration: number;
3449 handle: MediaSourceHandle;
3450 addSourceBuffer(type: string): SourceBuffer;
3451 removeSourceBuffer(sourceBuffer: SourceBuffer): void;
3452 endOfStream(error?: string): void;
3453 static isTypeSupported(type: string): boolean;
3454 }
3455
3456 declare class SourceBuffer extends EventTarget {
3457 mode: 'segments' | 'sequence';
3458 updating: boolean;
3459 buffered: TimeRanges;
3460 timestampOffset: number;
3461 audioTracks: AudioTrackList;
3462 videoTracks: VideoTrackList;
3463 textTracks: TextTrackList;
3464 appendWindowStart: number;
3465 appendWindowEnd: number;
3466
3467 appendBuffer(data: ArrayBuffer | $ArrayBufferView): void;
3468 // TODO: Add ReadableStream
3469 // appendStream(stream: ReadableStream, maxSize?: number): void;
3470 abort(): void;
3471 remove(start: number, end: number): void;
3472
3473 trackDefaults: TrackDefaultList;
3474 }
3475
3476 declare class SourceBufferList extends EventTarget {
3477 @@iterator(): Iterator<SourceBuffer>;
3478 [index: number]: SourceBuffer;
3479 length: number;
3480 }
3481
3482 declare class TrackDefaultList {
3483 [index: number]: TrackDefault;
3484 length: number;
3485 }
3486
3487 declare class TrackDefault {
3488 type: 'audio' | 'video' | 'text';
3489 byteStreamTrackID: string;
3490 language: string;
3491 label: string;
3492 kinds: Array<string>;
3493 }
3494
3495 // TODO: The use of `typeof` makes this function signature effectively
3496 // (node: Node) => number, but it should be (node: Node) => 1|2|3
3497 type NodeFilterCallback = (
3498 node: Node
3499 ) =>
3500 | typeof NodeFilter.FILTER_ACCEPT
3501 | typeof NodeFilter.FILTER_REJECT
3502 | typeof NodeFilter.FILTER_SKIP;
3503
3504 type NodeFilterInterface =
3505 | NodeFilterCallback
3506 | {acceptNode: NodeFilterCallback, ...};
3507
3508 // TODO: window.NodeFilter exists at runtime and behaves as a constructor
3509 // as far as `instanceof` is concerned, but it is not callable.
3510 declare class NodeFilter {
3511 static SHOW_ALL: -1;
3512 static SHOW_ELEMENT: 1;
3513 static SHOW_ATTRIBUTE: 2; // deprecated
3514 static SHOW_TEXT: 4;
3515 static SHOW_CDATA_SECTION: 8; // deprecated
3516 static SHOW_ENTITY_REFERENCE: 16; // deprecated
3517 static SHOW_ENTITY: 32; // deprecated
3518 static SHOW_PROCESSING_INSTRUCTION: 64;
3519 static SHOW_COMMENT: 128;
3520 static SHOW_DOCUMENT: 256;
3521 static SHOW_DOCUMENT_TYPE: 512;
3522 static SHOW_DOCUMENT_FRAGMENT: 1024;
3523 static SHOW_NOTATION: 2048; // deprecated
3524 static FILTER_ACCEPT: 1;
3525 static FILTER_REJECT: 2;
3526 static FILTER_SKIP: 3;
3527 acceptNode: NodeFilterCallback;
3528 }
3529
3530 // TODO: window.NodeIterator exists at runtime and behaves as a constructor
3531 // as far as `instanceof` is concerned, but it is not callable.
3532 declare class NodeIterator<RootNodeT, WhatToShowT> {
3533 root: RootNodeT;
3534 whatToShow: number;
3535 filter: NodeFilter;
3536 expandEntityReferences: boolean;
3537 referenceNode: RootNodeT | WhatToShowT;
3538 pointerBeforeReferenceNode: boolean;
3539 detach(): void;
3540 previousNode(): WhatToShowT | null;
3541 nextNode(): WhatToShowT | null;
3542 }
3543
3544 // TODO: window.TreeWalker exists at runtime and behaves as a constructor
3545 // as far as `instanceof` is concerned, but it is not callable.
3546 declare class TreeWalker<RootNodeT, WhatToShowT> {
3547 root: RootNodeT;
3548 whatToShow: number;
3549 filter: NodeFilter;
3550 expandEntityReferences: boolean;
3551 currentNode: RootNodeT | WhatToShowT;
3552 parentNode(): WhatToShowT | null;
3553 firstChild(): WhatToShowT | null;
3554 lastChild(): WhatToShowT | null;
3555 previousSibling(): WhatToShowT | null;
3556 nextSibling(): WhatToShowT | null;
3557 previousNode(): WhatToShowT | null;
3558 nextNode(): WhatToShowT | null;
3559 }
3560
3561 /* Window file picker */
3562
3563 type WindowFileSystemPickerFileType = {|
3564 description?: string,
3565 /*
3566 * An Object with the keys set to the MIME type
3567 * and the values an Array of file extensions
3568 * Example:
3569 * accept: {
3570 * "image/*": [".png", ".gif", ".jpeg", ".jpg"],
3571 * },
3572 */
3573 accept: {
3574 [string]: Array<string>,
3575 },
3576 |};
3577
3578 type WindowBaseFilePickerOptions = {|
3579 id?: number,
3580 startIn?:
3581 | FileSystemHandle
3582 | 'desktop'
3583 | 'documents'
3584 | 'downloads'
3585 | 'music'
3586 | 'pictures'
3587 | 'videos',
3588 |};
3589
3590 type WindowFilePickerOptions = WindowBaseFilePickerOptions & {|
3591 excludeAcceptAllOption?: boolean,
3592 types?: Array<WindowFileSystemPickerFileType>,
3593 |};
3594
3595 type WindowOpenFilePickerOptions = WindowFilePickerOptions & {|
3596 multiple?: boolean,
3597 |};
3598
3599 type WindowSaveFilePickerOptions = WindowFilePickerOptions & {|
3600 suggestedName?: string,
3601 |};
3602
3603 type WindowDirectoryFilePickerOptions = WindowBaseFilePickerOptions & {|
3604 mode?: 'read' | 'readwrite',
3605 |};
3606
3607 // https://wicg.github.io/file-system-access/#api-showopenfilepicker
3608 declare function showOpenFilePicker(
3609 options?: WindowOpenFilePickerOptions
3610 ): Promise<Array<FileSystemFileHandle>>;
3611
3612 // https://wicg.github.io/file-system-access/#api-showsavefilepicker
3613 declare function showSaveFilePicker(
3614 options?: WindowSaveFilePickerOptions
3615 ): Promise<FileSystemFileHandle>;
3616
3617 // https://wicg.github.io/file-system-access/#api-showdirectorypicker
3618 declare function showDirectoryPicker(
3619 options?: WindowDirectoryFilePickerOptions
3620 ): Promise<FileSystemDirectoryHandle>;
3621
3622 /* Notification */
3623 type NotificationPermission = 'default' | 'denied' | 'granted';
3624 type NotificationDirection = 'auto' | 'ltr' | 'rtl';
3625 type VibratePattern = number | Array<number>;
3626 type NotificationAction = {
3627 action: string,
3628 title: string,
3629 icon?: string,
3630 ...
3631 };
3632 type NotificationOptions = {
3633 dir?: NotificationDirection,
3634 lang?: string,
3635 body?: string,
3636 tag?: string,
3637 image?: string,
3638 icon?: string,
3639 badge?: string,
3640 sound?: string,
3641 vibrate?: VibratePattern,
3642 timestamp?: number,
3643 renotify?: boolean,
3644 silent?: boolean,
3645 requireInteraction?: boolean,
3646 data?: ?any,
3647 actions?: Array<NotificationAction>,
3648 ...
3649 };
3650
3651 declare class Notification extends EventTarget {
3652 constructor(title: string, options?: NotificationOptions): void;
3653 static +permission: NotificationPermission;
3654 static requestPermission(
3655 callback?: (perm: NotificationPermission) => mixed
3656 ): Promise<NotificationPermission>;
3657 static +maxActions: number;
3658 onclick: ?(evt: Event) => mixed;
3659 onclose: ?(evt: Event) => mixed;
3660 onerror: ?(evt: Event) => mixed;
3661 onshow: ?(evt: Event) => mixed;
3662 +title: string;
3663 +dir: NotificationDirection;
3664 +lang: string;
3665 +body: string;
3666 +tag: string;
3667 +image?: string;
3668 +icon?: string;
3669 +badge?: string;
3670 +vibrate?: Array<number>;
3671 +timestamp: number;
3672 +renotify: boolean;
3673 +silent: boolean;
3674 +requireInteraction: boolean;
3675 +data: any;
3676 +actions: Array<NotificationAction>;
3677
3678 close(): void;
3679 }