Permalink
Browse files

Revert "Calling this. Everywhere."

This reverts commit b43547b.

It seems that .call(this) doesn't really solve our issues with JScript and it creates issues in environments such as NodeJS. Let's reiterate on a proper fix for ES5 strict at a later time.
  • Loading branch information...
1 parent 02041b1 commit 8521f484fff56bafe48bbaed5ff3dced760d3822 @cpojer cpojer committed Mar 10, 2011
View
2 Source/Browser/Browser.js
@@ -259,4 +259,4 @@ this.$exec = Browser.exec;
//</1.2compat>
-}).call(this);
+})();
View
2 Source/Class/Class.Extras.js
@@ -118,4 +118,4 @@ this.Options = new Class({
});
-}).call(this);
+})();
View
2 Source/Class/Class.js
@@ -112,4 +112,4 @@ Class.Mutators = {
}
};
-}).call(this);
+})();
View
2 Source/Core/Core.js
@@ -508,4 +508,4 @@ this.$unlink = function(object){
//</1.2compat>
-}).call(this);
+})();
View
2 Source/Element/Element.Dimensions.js
@@ -241,7 +241,7 @@ function getCompatElement(element){
return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
}
-}).call(this);
+})();
//aliases
Element.alias({position: 'setPosition'}); //compatability
View
2 Source/Element/Element.Event.js
@@ -172,4 +172,4 @@ Element.Events = new Hash(Element.Events);
//</1.2compat>
-}).call(this);
+})();
View
2 Source/Element/Element.Style.js
@@ -180,4 +180,4 @@ Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, bor
Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)';
});
-}).call(this);
+})();
View
2 Source/Fx/Fx.js
@@ -176,4 +176,4 @@ var pullInstance = function(fps){
}
};
-}).call(this);
+})();
View
2 Source/Utilities/JSON.js
@@ -78,4 +78,4 @@ JSON.decode = function(string, secure){
return eval('(' + string + ')');
};
-}).call(this);
+})();
View
2 Source/Utilities/Swiff.js
@@ -110,4 +110,4 @@ Swiff.remote = function(obj, fn){
return eval(rs);
};
-}).call(this);
+})();

9 comments on commit 8521f48

@SunboX

Why?

@kassens
MooTools member

See the commit message.

@SunboX

Ah, ok. :o)

@cpojer
MooTools member

This issue just sucks. We have a number of solutions but for now its best to just revert this (literally). I guess the optimal solution would really be to always involve a build process for separate environments, however the problem of using/testing unbuild files persists and we want to avoid that. So the ideal solution would not require much additional code, would not expose new public API and work across all environments (ES3, ES5 strict) without involving a build process. Given that in server side JScript there is simply no global object available (?) this problem just becomes more tedious.

I'm just afraid of people putting a "use strict"; into any file (without wrapping it in a function) before loading mootools and having it break MooTools (in FF4, for example). Well, we are just not strict compliant yet anyway.

@partheseas

I use .apply(this) in my JavaScript files, and "use strict" doesn't break anything for me. Have you tried it?

@cpojer
MooTools member

Have you tried Firefox 4?

@partheseas

I tried it in Chrome 11. It threw a few errors afterwards (that I fixed!) so I figured they would be the same.

Oops.. I hadn't.. Yeah, it breaks. :\ But not because of the .apply(this). It breaks because of document.head = document.head || document.getElementsByTagName('head')[0]; saying "setting a property that only has a getter" I have no idea what that means. xD

If I comment that line out though, it works perfectly. (Except for the stuff that uses document.head..)

@cpojer
MooTools member

Oh right, sorry I didn't read it properly (it's late!). It will work with .apply(this) in the Browser. If you "use strict" however and remove the .apply(this) it will break.

@partheseas

Do .apply() and .call() just cause problems in server environments?

Please sign in to comment.