Skip to content
Permalink
Browse files

Remove `undefined` var declarations

  • Loading branch information
timmywil committed Jul 8, 2013
1 parent 1f67d07 commit c93f91e33ee25e60683fd05ae0210c9b07f2e2ac
Showing with 2 additions and 2 deletions.
  1. +1 −1 src/intro.js
  2. +1 −1 src/sizzle
@@ -45,7 +45,7 @@
}

// Pass this, window may not be defined yet
}(this, function ( window, undefined ) {
}(this, function ( window ) {

// Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if

7 comments on commit c93f91e

@serbanghita

This comment has been minimized.

Copy link

serbanghita replied Jul 12, 2013

@timmywil why was undefined removed? Shouldn't it protect jQuery from user overwriting the undefined variable? Thanks

@mgol

This comment has been minimized.

Copy link
Member

mgol replied Jul 12, 2013

@serbanghita It's because most projects don't protect against such overwriting so if anyone does that (but.. why?) they're already screwed on so many levels...

@FagnerMartinsBrack

This comment has been minimized.

Copy link

FagnerMartinsBrack replied Jul 12, 2013

Isn't undefined turned into an undefined variable to reduce size on minification? Not familiarized with the codebase btw, just watching.

@timmywil

This comment has been minimized.

Copy link
Member Author

timmywil replied Jul 13, 2013

It wasn't saving us that much so the team agreed we'd rather not have it.

@davidmurdoch

This comment has been minimized.

Copy link
Contributor

davidmurdoch replied Jul 16, 2013

Is there any benefit in removing undefined?

@timmywil

This comment has been minimized.

Copy link
Member Author

timmywil replied Jul 16, 2013

@davidmurdoch There isn't enough benefit in having it. But yes, one benefit is that it clears up parameters for an eventual jQuery-creating factory (where jQuery could be re-created with a different context and we can document the factory's signature without worrying about this unnecessary undefined variable). We could do var undefined instead at the top of the closure, but like I said, there isn't enough benefit.

@davidmurdoch

This comment has been minimized.

Copy link
Contributor

davidmurdoch replied Jul 17, 2013

I do wonder what the GZIP byte diff is for undefined parameter vs var undefined, vs the omitted undefined? If you have them, can you publish them here?

Please sign in to comment.
You can’t perform that action at this time.