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, '');
};
(function() {
(function(global) {
var log, method, object;
for (method in Ox.fallback) {
object = method == 'bind' ? Function.prototype
@ -286,19 +286,19 @@ Ox.fallback.trim = function() {
object[method] = Ox.fallback[method];
}
}
// IE8 has window.console, but window.console.log is an object,
// IE9 has window.console, but window.console.log has no apply
// In IE8, window.console.log is an object,
// 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
if (window.console) {
if (typeof window.console.log !== 'function') {
log = window.console.log;
window.console.log = function() {
if (global.console) {
if (typeof global.console.log !== 'function') {
log = global.console.log;
global.console.log = function() {
log(Array.prototype.slice.call(arguments).join(' '));
}
} else if (!window.console.log.apply) {
window.console.log = Function.prototype.bind.call(
window.console.log, window.console
} else if (!global.console.log.apply) {
global.console.log = Function.prototype.bind.call(
global.console.log, global.console
);
}
}
})();
})(this);