Skip to content

Commit

Permalink
capricorn86#1092@patch: Simplifies MediaQueryListEvent.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrotoff committed Sep 30, 2023
1 parent 8f53fee commit e31aff4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/happy-dom/src/event/events/MediaQueryListEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import IMediaQueryListInit from './IMediaQueryListInit.js';
*
*/
export default class MediaQueryListEvent extends Event {
public readonly matches: boolean = false;
public readonly media: string = '';
public readonly matches: boolean;
public readonly media: string;

/**
* Constructor.
Expand All @@ -17,9 +17,7 @@ export default class MediaQueryListEvent extends Event {
constructor(type: string, eventInit: IMediaQueryListInit = null) {
super(type, eventInit);

if (eventInit) {
this.matches = eventInit.matches || false;
this.media = eventInit.media || '';
}
this.matches = eventInit.matches ?? false;
this.media = eventInit.media ?? '';
}
}

0 comments on commit e31aff4

Please sign in to comment.