Last active
August 29, 2015 14:14
-
-
Save dvdrtrgn/4a20f61e7eed96cd905d to your computer and use it in GitHub Desktop.
old IE fixer
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
Date.now = Date.now || function () { | |
return +new Date(); | |
}; | |
W.addEventListener = W.addEventListener || function (nom, fn) { | |
W.attachEvent('on' + nom, fn); | |
}; |
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 i, W = window, C = (W.console || { | |
log: function () {} | |
}); | |
if (window.window !== window) { | |
W = W.window; | |
C.all = 'log info error warn'.split(' '); // supplant these | |
for (i = 0; i < C.all.length; i++)(function (key) { | |
C[key] = (typeof C[key] === 'function') ? C[key] : function () { | |
if (C[key]) C[key](Array.prototype.slice.call(arguments).join(', ')); | |
}; // close over the itr key function ref | |
}(C.all[i])); | |
C.all = 'assert clear count debug dir dirxml ' + // alias the rest | |
' exception group groupCollapsed groupEnd markTimeline ' + // | |
' profile profileEnd time timeEnd trace'.split(' '); | |
for (i = 0; i < C.all.length; i++)(function (key) { | |
C[key] = function () { | |
C.warn(Array.prototype.slice.call(arguments).join(', ') + '<' + key); | |
}; // close over the itr key | |
}(C.all[i])); | |
C.debug('IE8', 'Slippery window,', 'Dippy console'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment