File tree Expand file tree Collapse file tree 5 files changed +49
-0
lines changed
Expand file tree Collapse file tree 5 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @remote-dom/polyfill ' : patch
3+ ---
4+
5+ add ` FocusEvent ` , ` ClipboardEvent ` and ` ToggleEvent ` to polyfill
Original file line number Diff line number Diff line change 1+ import { Event } from './Event.ts' ;
2+
3+ // https://w3c.github.io/clipboard-apis/#clipboardevent-interface
4+ export class ClipboardEvent extends Event {
5+ readonly clipboardData : ClipboardEventInit [ 'clipboardData' ] ;
6+
7+ constructor ( type : string , eventInitDict : ClipboardEventInit = { } ) {
8+ super ( type , eventInitDict ) ;
9+
10+ this . clipboardData = eventInitDict . clipboardData ?? null ;
11+ }
12+ }
Original file line number Diff line number Diff line change 1+ import { Event } from './Event.ts' ;
2+
3+ // https://w3c.github.io/uievents/#interface-focusevent
4+ export class FocusEvent extends Event {
5+ readonly relatedTarget : FocusEventInit [ 'relatedTarget' ] ;
6+
7+ constructor ( type : string , eventInitDict : FocusEventInit = { } ) {
8+ super ( type , eventInitDict ) ;
9+
10+ this . relatedTarget = eventInitDict . relatedTarget ?? null ;
11+ }
12+ }
Original file line number Diff line number Diff line change 1+ import { Event } from './Event.ts' ;
2+
3+ // https://html.spec.whatwg.org/multipage/popover.html#toggleevent
4+ export class ToggleEvent extends Event {
5+ readonly oldState : ToggleEventInit [ 'oldState' ] ;
6+ readonly newState : ToggleEventInit [ 'newState' ] ;
7+
8+ constructor ( type : string , eventInitDict : ToggleEventInit ) {
9+ super ( type , eventInitDict ) ;
10+
11+ this . oldState = eventInitDict . oldState ;
12+ this . newState = eventInitDict . newState ;
13+ }
14+ }
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ import {EventTarget} from './EventTarget.ts';
44import { CustomEvent } from './CustomEvent.ts' ;
55import { ErrorEvent } from './ErrorEvent.ts' ;
66import { PromiseRejectionEvent } from './PromiseRejectionEvent.ts' ;
7+ import { ToggleEvent } from './ToggleEvent.ts' ;
8+ import { FocusEvent } from './FocusEvent.ts' ;
9+ import { ClipboardEvent } from './ClipboardEvent.ts' ;
710import { Node } from './Node.ts' ;
811import { ParentNode } from './ParentNode.ts' ;
912import { ChildNode } from './ChildNode.ts' ;
@@ -44,6 +47,9 @@ export class Window extends EventTarget {
4447 Event = Event ;
4548 ErrorEvent = ErrorEvent ;
4649 PromiseRejectionEvent = PromiseRejectionEvent ;
50+ ToggleEvent = ToggleEvent ;
51+ FocusEvent = FocusEvent ;
52+ ClipboardEvent = ClipboardEvent ;
4753 EventTarget = EventTarget ;
4854 CustomEvent = CustomEvent ;
4955 Node = Node ;
You can’t perform that action at this time.
0 commit comments