Make console.log check more robust; fixes IE8

This commit is contained in:
kangax 2014-12-07 13:08:41 +01:00
parent 77434e6086
commit e780b0a958

View file

@ -11,8 +11,12 @@ fabric.log = function() { };
fabric.warn = function() { };
if (typeof console !== 'undefined') {
['log', 'warn'].forEach(function(methodName) {
if (typeof console[methodName] !== 'undefined' && console[methodName].apply) {
if (typeof console[methodName] !== 'undefined' &&
typeof console[methodName].apply === 'function') {
fabric[methodName] = function() {
return console[methodName].apply(console, arguments);
};