I'm looking for a way to minify a code like this:
setTimeout(function() {
document.getElementById('test').innerText = 'Hello World!';
}, 1000);
To something like this (minus spaces and new lines):
(function(a,b){
a(function(){
b('test').innerText='Hello World!';
}, 1000);
})(setTimeout, document.getElementById)
using an automatic tool like UglifyJS or similar. From the documentation it doesn't seem to be an option to do that.
EDIT: It's quite common to see code like this:
(function (window, document, undefined) {
// code here
})(window, document);
This is done for performance and to make the code more minifier-friendly, so I'm wondering why this is not done on a deeper level.