From e31aff44e7c511da2c750d6c00eb6c1431739572 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Sun, 24 Sep 2023 17:18:46 +0200 Subject: [PATCH] #1092@patch: Simplifies MediaQueryListEvent. https://drafts.csswg.org/cssom-view/#the-mediaquerylist-interface. --- .../happy-dom/src/event/events/MediaQueryListEvent.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/happy-dom/src/event/events/MediaQueryListEvent.ts b/packages/happy-dom/src/event/events/MediaQueryListEvent.ts index 9125568e8..10afd2e30 100644 --- a/packages/happy-dom/src/event/events/MediaQueryListEvent.ts +++ b/packages/happy-dom/src/event/events/MediaQueryListEvent.ts @@ -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. @@ -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 ?? ''; } }