Skip to content

window.innerWidth / innerHeight #591

Closed Answered by capricorn86
WebMechanic asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @WebMechanic! 🙂

The change was intentional as it is now possible to send in "innerWidth" and "innerHeight" as properties to the constructor.

Offset properties has not been changed. They are set to 0 as Happy DOM currently doesn't support calculating them yet, but I guess we could set them to the same as "innerWidth" and "innerHeight" on the document element.

It is also possible to set "innerWidth" and "innerHeight" now through a method, which will trigger a "resize" event.

I have just updated the documentation to cover this.

Documentation:
https://github.com/capricorn86/happy-dom/tree/master/packages/happy-dom

Example 1:

const window = new Window({
    innerWidth: 1024,
    innerHeight: 

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@WebMechanic
Comment options

@capricorn86
Comment options

@WebMechanic
Comment options

@csantos-nydig
Comment options

@csantos-nydig
Comment options

Answer selected by WebMechanic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants