Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window.location.href = 'value' returns 'about:blank' in v13.0.0 #1230

Closed
gkiely opened this issue Jan 22, 2024 · 4 comments · Fixed by #1231
Closed

window.location.href = 'value' returns 'about:blank' in v13.0.0 #1230

gkiely opened this issue Jan 22, 2024 · 4 comments · Fixed by #1231
Assignees
Labels
bug Something isn't working

Comments

@gkiely
Copy link

gkiely commented Jan 22, 2024

Describe the bug
In versions prior to v13, using GlobalRegistrator.register() and window.location.href = 'value' would set the href value. In v13 it always returns the value "about:blank"

In addition to this, clicking on links no longer updates window.location.href.

To Reproduce
Steps to reproduce the behavior:

import { GlobalRegistrator } from '@happy-dom/global-registrator';
GlobalRegistrator.register();
window.location.href = 'value';
console.log(window.location.href); // "about:blank"

Expected behavior
Prints the value that was set.

Device:

  • OS: macOS
  • Version: 13
@gkiely gkiely added the bug Something isn't working label Jan 22, 2024
@gkiely
Copy link
Author

gkiely commented Jan 23, 2024

@gkiely
Copy link
Author

gkiely commented Jan 23, 2024

Workaround is to set:

Object.defineProperty(window.location, 'href', {
  writable: true,
});

@capricorn86 capricorn86 self-assigned this Jan 24, 2024
capricorn86 added a commit that referenced this issue Jan 24, 2024
…location.href" when using Happy DOM in the global scope (e.g. by using @happy-dom/global-registrator).
capricorn86 added a commit that referenced this issue Jan 24, 2024
…f-=-value-returns-aboutblank-in-v1300

#1230@patch: Fixes issue where it is not possible to set "globalThis.…
@gkiely
Copy link
Author

gkiely commented Jan 24, 2024

@capricorn86 Thank you!

@capricorn86
Copy link
Owner

No problem @gkiely! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants