Skip to content

Pass window, not this to the main IIFE. Fixes #13760.#1238

Closed
mgol wants to merge 1 commit intojquery:masterfrom
mgol:13760-node
Closed

Pass window, not this to the main IIFE. Fixes #13760.#1238
mgol wants to merge 1 commit intojquery:masterfrom
mgol:13760-node

Conversation

@mgol
Copy link
Member

@mgol mgol commented Apr 10, 2013

This is needed for node compatibility; there are many places dependent
on window being the true window, not just the global object. We don't
actually need node's global object inside the closure, it's exported
using module.exports anyway.

This is needed for node compatibility; there are many places dependent
on window being the true window, not just the global object. We don't
actually need node's global object inside the closure, it's exported
using module.exports anyway.
@rwaldron
Copy link
Member

What happens when "window" is undefined?

@mgol
Copy link
Member Author

mgol commented Apr 10, 2013

It breaks at the beginning then (location = window.location). But aren't we screwed then anyway? Are there cases where we'd like to work without window?

If that's the case, I can always change window to window || this.

@timmywil
Copy link
Member

Seems like this is right. jQuery won't work without the DOM.

@mgol
Copy link
Member Author

mgol commented Apr 10, 2013

Yup, that's what I thought. So it should be OK then.

Why was it changed to this in the first place?

@rwaldron
Copy link
Member

For the reason I said above, but I prefer the approach here anyway.

@rwaldron rwaldron closed this in e80117a Apr 10, 2013
@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants