Skip to content

Commit df3e0ea

Browse files
committed
browser: use typeof to check for console existence
It's a global, so we must check with typeof otherwise an error will be thrown if `console` is undefined.
1 parent 4fd6f39 commit df3e0ea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

browser.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ function formatArgs() {
112112
*/
113113

114114
function log() {
115-
// This hackery is required for IE8,
116-
// where the `console.log` function doesn't have 'apply'
117-
return console
115+
// this hackery is required for IE8/9, where
116+
// the `console.log` function doesn't have 'apply'
117+
return 'object' === typeof console
118118
&& console.log
119119
&& Function.prototype.apply.call(console.log, console, arguments);
120120
}

0 commit comments

Comments
 (0)