Skip to content

Commit

Permalink
capricorn86#1092@patch: Simplifies FocusEvent.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrotoff committed Sep 30, 2023
1 parent afce504 commit 4ff55a1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/happy-dom/src/event/events/FocusEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ import IFocusEventInit from './IFocusEventInit.js';
*
*/
export default class FocusEvent extends UIEvent {
public readonly relatedTarget: EventTarget = null;
public readonly relatedTarget: EventTarget | null;

/**
* Constructor.
*
* @param type Event type.
* @param [eventInit] Event init.
*/
constructor(type: string, eventInit: IFocusEventInit = null) {
constructor(type: string, eventInit: IFocusEventInit = {}) {
super(type, eventInit);

if (eventInit) {
this.relatedTarget = eventInit.relatedTarget || null;
}
this.relatedTarget = eventInit.relatedTarget ?? null;
}
}

0 comments on commit 4ff55a1

Please sign in to comment.