-
Notifications
You must be signed in to change notification settings - Fork 27.4k
only call console.log when window.console exists #14007
Conversation
issue #14006 - `window.console` only exists in IE 8 & 9 when the devtools are open
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
1 similar comment
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
1 similar comment
CLAs look good, thanks! |
@@ -1,6 +1,8 @@ | |||
if (window.angular.bootstrap) { | |||
//AngularJS is already loaded, so we can return here... | |||
console.log('WARNING: Tried to load angular more than once.'); | |||
if (!!window.console) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not if (window.console)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's personal preference. I prefer to test if something is true
rather than truthy
; !!window.console
is a boolean while window.console
is something
I don't think it has any impact on anything so if you prefer if (window.console)
i'll change it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are doing !! then you are still relying on console being truthy though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah but my if
is testing a boolean, not a something that is truthy or falsy
when i read this code
var foo, bar;
...
if (foo) { ... }
if (!!bar) { ... }
I assume foo is a boolean
while bar is a something
as i said it's just personal preference
fun fact with momentjs, moment.duration(0)
is truthy while being equal to 0
moment.duration(0) == 0; // true
moment.duration(0) === 0; // false
!!moment.duration(0); // true
!!0; // false, obviously
Ideally, we should have an e2e test for this. Do you want to give it a shot? There's a sample e2e test in test/e2e/sample. |
I tried for the last 2 hours to make grunt work, following the angular contribute doc but it just don't want to register there is a I dont know whats causing it, i'll let you handle the e2e test I'll try to make it work for my next contribution i'm running a command prompt on win 10 as admin and typing
and getting
when the
I've worked with grunt professionally for the past year, it's not my first walk around the park |
Grunt must be installed without the -g flag. Only grunt-cli must be
|
I'm giving up here on the e2e test also grunt is referenced in |
Sorry about that. It's possible that the latest node / npm versions are not quite compatible yet with our ancient setup. |
issue angular#14006 - `window.console` only exists in IE 8 & 9 when the devtools are open Closes angular#14007
`window.console` only exists in IE 8 & 9 when the devtools are open Fixes angular#14006 Closes angular#14007 Closes angular#14047
issue #14006 -
window.console
only exists in IE 8 & 9 when the devtools are open