Open
Description
Describe the bug
When executing { ...window.location }
in the browser, you get back an object containing all the usual properties like
{ href: ..., origin: ..., pathname: ..., search: ..., hash: ... }
etc.
In happy-dom, this does not work, since the spread operator only considers non-private fields and the Location class currently stores a private URL instead.
To Reproduce
Steps to reproduce the behavior:
- Execute
{ ...window.location }
in the dev tools of this tab - Execute a happy-dom test and log
{ ...window.location }
out - See a noticable difference
Expected behavior
The outcome is the same (object with all properties of window.location)
Device:
- any
Additional context
I suggest fixing this bug by adding non-private (they may be typescript-private but not #) fields to the location class,
which mirror the fields in the private URL field. When URL is set, also set all related fields.