use global, not window

This commit is contained in:
rolux 2012-05-25 18:33:12 +02:00
parent 8a7e0dff11
commit 873dc2e550

View file

@ -274,7 +274,7 @@ Ox.fallback.trim = function() {
return this.replace(/^\s+|\s+$/g, ''); return this.replace(/^\s+|\s+$/g, '');
}; };
(function() { (function(global) {
var log, method, object; var log, method, object;
for (method in Ox.fallback) { for (method in Ox.fallback) {
object = method == 'bind' ? Function.prototype object = method == 'bind' ? Function.prototype
@ -286,19 +286,19 @@ Ox.fallback.trim = function() {
object[method] = Ox.fallback[method]; object[method] = Ox.fallback[method];
} }
} }
// IE8 has window.console, but window.console.log is an object, // In IE8, window.console.log is an object,
// IE9 has window.console, but window.console.log has no apply // in IE9, window.console.log.apply is undefined
// see http://stackoverflow.com/questions/5472938/does-ie9-support-console-log-and-is-it-a-real-function // see http://stackoverflow.com/questions/5472938/does-ie9-support-console-log-and-is-it-a-real-function
if (window.console) { if (global.console) {
if (typeof window.console.log !== 'function') { if (typeof global.console.log !== 'function') {
log = window.console.log; log = global.console.log;
window.console.log = function() { global.console.log = function() {
log(Array.prototype.slice.call(arguments).join(' ')); log(Array.prototype.slice.call(arguments).join(' '));
} }
} else if (!window.console.log.apply) { } else if (!global.console.log.apply) {
window.console.log = Function.prototype.bind.call( global.console.log = Function.prototype.bind.call(
window.console.log, window.console global.console.log, global.console
); );
} }
} }
})(); })(this);