- 2009-04-29 (Wed) 11:55
- JavaScript | Tech
So, I was at work in this morning, tried to start to work on the task I’ve been working on a while. I looked up my task note (wiki) and run some code (on browser, naturally, I’m a JavaScript geek), then I realized that it stopped because of unfamiliar errors. Wait. It was working last night. Then I ran some debuggers, then I found weird functions on each function. I asked people on the internal IRC channel. And I figured this:
http://partner.googleadservices.com/gampad/google_service.js
Let me just quote its high light here:
if (t.MODIFY_FUNCTION_PROTOTYPES = f) {
Function.prototype.bind = function(a) {
if (arguments.length > 1) {
var b = Array.prototype.slice.call(arguments, 1);
b.unshift(this, a);
return t.bind.apply(c, b)
} else return t.bind(this, a)
};
Function.prototype.partial = function() {
var a = Array.prototype.slice.call(arguments);
a.unshift(this, c);
return t.bind.apply(c, a)
};
Function.prototype.inherits = function(a) {
t.inherits(this, a)
};
Function.prototype.mixin = function(a) {
t.mixin(this.prototype, a)
}
};
It looks even different from what I saw at the office, actually. but I believe it’s the very same result since variable f is actually assigned for “true” in the very beginning.
And I googled a while and found this:
Question: google_service.js conflicts with prototype.js
Good job jimthoburn! Google usually doesn’t listen to outside voice.
I really hope that Google will stop doing this very very soon. I mean like tomorrow. It’s not only about Prototype.js, in face I don’t use Prototype.js at work. But IT IS REALLY BAD practice to contaminate Standard Global Objects in JavaScript. Please please do not do this.
- Newer: Timer Performance in Browsers
- Older: Meetup.Tweener (0.5.1)
Comments:0
Trackbacks:0
- Trackback URL for this entry
- http://blog.nydd.org/2009/04/dear-google-stop-contaminating-standard-global-objects-in-javascript/trackback/
- Listed below are links to weblogs that reference
- Dear Google: Stop contaminating Standard Global Objects in JavaScript from Vantage Point of Queens