From 1c0eb6d2bd55fe5105684ef04ecd0d91ab7fa9de Mon Sep 17 00:00:00 2001 From: Jean-Yves Moyen Date: Mon, 22 Jul 2024 10:14:24 +0200 Subject: [PATCH] Improve handling of default options --- .changeset/dirty-horses-exist.md | 5 +++++ packages/alfa-web/src/page.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/dirty-horses-exist.md diff --git a/.changeset/dirty-horses-exist.md b/.changeset/dirty-horses-exist.md new file mode 100644 index 0000000000..554fe37036 --- /dev/null +++ b/.changeset/dirty-horses-exist.md @@ -0,0 +1,5 @@ +--- +"@siteimprove/alfa-web": patch +--- + +**Changed:** Improved handling of default options in `Page#.toJSON()`. diff --git a/packages/alfa-web/src/page.ts b/packages/alfa-web/src/page.ts index b3dbe59846..57f5e00ec9 100644 --- a/packages/alfa-web/src/page.ts +++ b/packages/alfa-web/src/page.ts @@ -69,7 +69,10 @@ export class Page return { request: this._request.toJSON(options), response: this._response.toJSON(options), - document: this._document.toJSON(options ?? { device: this._device }), + document: this._document.toJSON({ + device: this._device, + ...(options ?? {}), + }), device: this._device.toJSON(options), }; }