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

9 comments on commit 8521f48

@SunboX

This comment has been minimized.

Show comment
Hide comment

Why?

@kassens

This comment has been minimized.

Show comment
Hide comment
@kassens

kassens Mar 10, 2011

Member

See the commit message.

Member

kassens replied Mar 10, 2011

See the commit message.

@SunboX

This comment has been minimized.

Show comment
Hide comment
@SunboX

SunboX Mar 10, 2011

Ah, ok. :o)

Ah, ok. :o)

@cpojer

This comment has been minimized.

Show comment
Hide comment
@cpojer

cpojer Mar 10, 2011

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.

Member

cpojer replied Mar 10, 2011

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

This comment has been minimized.

Show comment
Hide comment
@partheseas

partheseas Apr 9, 2011

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

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

@cpojer

This comment has been minimized.

Show comment
Hide comment
@cpojer

cpojer Apr 9, 2011

Member

Have you tried Firefox 4?

Member

cpojer replied Apr 9, 2011

Have you tried Firefox 4?

@partheseas

This comment has been minimized.

Show comment
Hide comment
@partheseas

partheseas Apr 9, 2011

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

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

This comment has been minimized.

Show comment
Hide comment
@cpojer

cpojer Apr 9, 2011

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.

Member

cpojer replied Apr 9, 2011

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

This comment has been minimized.

Show comment
Hide comment
@partheseas

partheseas Apr 9, 2011

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

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

Please sign in to comment.