Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
wants to merge 1 commit into from

3 participants

@mzgol
Collaborator

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.

@mzgol mzgol 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
Collaborator

What happens when "window" is undefined?

@mzgol
Collaborator

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
Collaborator

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

@mzgol
Collaborator

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

Why was it changed to this in the first place?

@rwaldron
Collaborator

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

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

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

    mzgol authored
    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 page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  src/outro.js
View
2  src/outro.js
@@ -1,2 +1,2 @@
-})( this );
+})( window );
Something went wrong with that request. Please try again.