Merge pull request #1308 from marcelklehr/fix/console-log-html10n-chrome
Fix #1307: Chrome needs console.log to be called on console objpull/1310/head
commit
d9ef9f5648
|
@ -21,8 +21,29 @@
|
||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
window.html10n = (function(window, document, undefined) {
|
window.html10n = (function(window, document, undefined) {
|
||||||
var consoleLog = console? console.log : function() {}
|
var console = window.console
|
||||||
, consoleWarn = console? console.warn : function() {}
|
function interceptConsole(method){
|
||||||
|
var original = console[method]
|
||||||
|
|
||||||
|
if (!console) return function() {}
|
||||||
|
|
||||||
|
// do sneaky stuff
|
||||||
|
if (original.bind){
|
||||||
|
// Do this for normal browsers
|
||||||
|
return original.bind(console)
|
||||||
|
}else{
|
||||||
|
return function() {
|
||||||
|
// Do this for IE
|
||||||
|
var message = Array.prototype.slice.apply(arguments).join(' ')
|
||||||
|
original(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var consoleLog = interceptConsole('log')
|
||||||
|
, consoleWarn = interceptConsole('warn')
|
||||||
|
, consoleError = interceptConsole('warn')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MicroEvent - to make any js object an event emitter (server or browser)
|
* MicroEvent - to make any js object an event emitter (server or browser)
|
||||||
|
|
Loading…
Reference in New Issue