Skip to content

Always prefer === over == (and !== over !=) in JavaScript #1274

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

Merged
merged 3 commits into from
May 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions debug_toolbar/static/debug_toolbar/js/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
};

var onKeyDown = function(event) {
if (event.keyCode == 27) {
if (event.keyCode === 27) {
djdt.hide_one_level();
}
};
Expand Down Expand Up @@ -106,7 +106,7 @@

var ajax_data = {};

if (this.tagName == 'BUTTON') {
if (this.tagName === 'BUTTON') {
var form = this.closest('form');
ajax_data.url = this.getAttribute('formaction');

Expand All @@ -116,7 +116,7 @@
}
}

if (this.tagName == 'A') {
if (this.tagName === 'A') {
ajax_data.url = this.getAttribute('href');
}

Expand All @@ -133,7 +133,7 @@
event.preventDefault();
var self = this;
var id = this.dataset.toggleId;
var open_me = this.textContent == this.dataset.toggleOpen;
var open_me = this.textContent === this.dataset.toggleOpen;
var name = this.dataset.toggleName;
var container = this.closest('.djDebugPanelContent').querySelector('#' + name + '_' + id);
container.querySelectorAll('.djDebugCollapsed').forEach(function(e) {
Expand Down Expand Up @@ -173,7 +173,7 @@
// Chrome can send spurious mousemove events, so don't do anything unless the
// cursor really moved. Otherwise, it will be impossible to expand the toolbar
// due to djdt.handleDragged being set to true.
if (djdt.handleDragged || event.pageY != startPageY) {
if (djdt.handleDragged || event.pageY !== startPageY) {
var top = baseY + event.pageY;

if (top < 0) {
Expand Down Expand Up @@ -205,7 +205,7 @@
}, 10);
}
});
if (djdt.cookie.get('djdt') == 'hide') {
if (djdt.cookie.get('djdt') === 'hide') {
djdt.hide_toolbar(false);
} else {
djdt.show_toolbar();
Expand Down