-
Couldn't load subscription status.
- Fork 513
Open
Labels
Milestone
Description
I don't understand why the global object is still referenced by using the keyword this inside the closures since it won't be obfuscated/minimized. As an example, the following...
(function(){
this.MooTools = { /*! ... */ };
var typeOf = this.typeOf = function(item){ /*! ... */ };
})();... will be minimized as ...
(function(){this.MooTools={/*! ... */};var a=this.typeOf=function(b){/*! ... */};})();... while the now following ...
!function(window){
window.MooTools = { /*! ... */ };
var typeOf = window.typeOf = function(item){ /*! ... */ };
}(this);... will be minimized this way:
!function(a){a.MooTools={/*! ... */};var b=a.typeOf=function(c){/*! ... */};}(this);(Note: Negating the self invoking function [unless there is no returning value needed] saves the parentheses.)
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/55865-use-window-instead-of-this-in-closures-to-improve-obfuscation?utm_campaign=plugin&utm_content=tracker%2F22067&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F22067&utm_medium=issues&utm_source=github).