-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Unify null comparisons #11481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify null comparisons #11481
Conversation
wouterj
commented
Jul 26, 2014
Q | A |
---|---|
Fixed tickets | - |
License | MIT |
👍 |
1 similar comment
👍 |
Thank you @wouterj. |
This PR was merged into the 2.3 branch. Discussion ---------- Unify null comparisons | Q | A | ------------- | --- | Fixed tickets | - | License | MIT Commits ------- be04c50 Unify null comparisons
@@ -68,20 +68,20 @@ | |||
menu = document.getElementById('navigation'), savedState = Sfjs.getPreference('menu/displayState'), | |||
displayState, elem, className; | |||
|
|||
if (savedState == null) { | |||
if (null === savedState) { |
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.
You won't catch undefined with this check. null == savedState
<=> null === savedState || undefined === savedState
.
Not sure if this was intended here.
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.
Applies further down, too.
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.
Looks like it was replaced automatically (this part is JavaScript). @wouterj Can you have a look at this?
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.
I've checked all JS conditions comparing with null
in this PR and they all remain to work. All functions used in these conditions return null
or a value.
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.
Thanks @apfelbox for noting this. You've a sharp eye :)