Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 8521f484fff56bafe48bbaed5ff3dced760d3822 1 parent 02041b1
Christoph Pojer cpojer authored
2  Source/Browser/Browser.js
View
@@ -259,4 +259,4 @@ this.$exec = Browser.exec;
//</1.2compat>
-}).call(this);
+})();
2  Source/Class/Class.Extras.js
View
@@ -118,4 +118,4 @@ this.Options = new Class({
});
-}).call(this);
+})();
2  Source/Class/Class.js
View
@@ -112,4 +112,4 @@ Class.Mutators = {
}
};
-}).call(this);
+})();
2  Source/Core/Core.js
View
@@ -508,4 +508,4 @@ this.$unlink = function(object){
//</1.2compat>
-}).call(this);
+})();
2  Source/Element/Element.Dimensions.js
View
@@ -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
2  Source/Element/Element.Event.js
View
@@ -172,4 +172,4 @@ Element.Events = new Hash(Element.Events);
//</1.2compat>
-}).call(this);
+})();
2  Source/Element/Element.Style.js
View
@@ -180,4 +180,4 @@ Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, bor
Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)';
});
-}).call(this);
+})();
2  Source/Fx/Fx.js
View
@@ -176,4 +176,4 @@ var pullInstance = function(fps){
}
};
-}).call(this);
+})();
2  Source/Utilities/JSON.js
View
@@ -78,4 +78,4 @@ JSON.decode = function(string, secure){
return eval('(' + string + ')');
};
-}).call(this);
+})();
2  Source/Utilities/Swiff.js
View
@@ -110,4 +110,4 @@ Swiff.remote = function(obj, fn){
return eval(rs);
};
-}).call(this);
+})();

9 comments on commit 8521f48

André Fiedler

Why?

Jan Kassens
Collaborator

See the commit message.

André Fiedler

Ah, ok. :o)

Christoph Pojer
Owner

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.

Tyler Washburn

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

Christoph Pojer
Owner

Have you tried Firefox 4?

Tyler Washburn

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..)

Christoph Pojer
Owner

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.

Tyler Washburn

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

Please sign in to comment.
Something went wrong with that request. Please try again.