Created
November 1, 2010 20:42
-
-
Save rwaldron/658832 to your computer and use it in GitHub Desktop.
overwrites function.prototype.call with enforced scope. (the closure seems unnec. but is, when running in FF)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var originalCall = (function () { | |
return Function.prototype.call; | |
})(); | |
Function.prototype.call = function () { | |
console.log('Logging:', arguments); | |
return originalCall; | |
} | |
function foo(arg) { | |
return arg; | |
} | |
foo('this should log to the console'); | |
// Tested in FF4b6, FF3.6.13pre, 9.0.567.0 (64354) Ubuntu 10.04 |
I take that back, FF isn't logging. Firebug's implicit logging is what I was seeing. Duh.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes. It does. I just tested it - in the browsers I listed above. on Ubuntu 10.04