Closed unional closed 9 years ago
this is one of my personal favorite WTFIEs
@unional Thanks! Is it safe to use typeof localConsole.log !== 'undefined'
?
There are more issues that may arise in IE8. Just accessing a property on the console
object may throw an exception (e.g. typeof console.log
may throw). Everything around the console object, including property access and method calls, should be wrapped in try..catch
blocks.
@briancavalier I think it is ok to do typeof localConsole.log !== 'undefined'
, since this really only affect ie <=8 and quirks mode. I will update the code accordingly.
Also, I'll update the code to better support scenario without JSON. Currently, it will throw error in ConsoleReporter.log
.
@unional when.js 3.x requires an ES5 environment, and since JSON is part of the ES5 spec, we can assume it's there and works. Folks needing to support older browsers can polyfill to ES5.
In contrast, console
isn't part of EcmaScript. So, I'm cool with jumping through a few more hoops to make sure we're not breaking envs that have console quirks, like IE.
@unional looking good. If you squash the commits, I'll get this merged asap!
@unional Ping. I'm happy to merge this if you'll squash the commits. Thanks!
@brian, sorry for the late reply. Have been busy lately. I have attempted to squashed the commits. I don't know if I'm doing it correctly. If I wasn't, please let me know and I will redo it.
Thanks,
On Mon, Mar 23, 2015 at 5:24 AM, Brian Cavalier notifications@github.com wrote:
@unional https://github.com/unional Ping. I'm happy to merge this if you'll squash the commits. Thanks!
— Reply to this email directly or view it on GitHub https://github.com/cujojs/when/pull/436#issuecomment-84970912.
@unional Thanks. There's a merge commit in the mix now, unfortunately. No worries, though, I'll merge your change in 168a26d manually.
@unional Sorry for letting this sit for a while! I just merged your change into master in bfee33d. I'll pull together a new release later this week.
Thanks again!
IE8 typeof returns "object" instead of "function", so checking for "function" doesn't work.