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

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@mgol
Member
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.

@mgol mgol Pass window, not this to the main IIFE. Fixes #13760.
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.
76ea7ef
@rwaldron
Member

What happens when "window" is undefined?

@mgol
Member
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
Member

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

@mgol
Member
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
Member

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

@rwaldron rwaldron closed this in e80117a Apr 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment