HTML: prevent implicit type conversion on testing

== and != comparison of true, false, null, allows implicit type
conversion, thus using === and !== instead

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Miika Turkia 2014-07-14 20:39:42 +03:00 committed by Dirk Hohndel
parent 6f05194b02
commit db43fbbe8a

View file

@ -528,7 +528,7 @@ function SearchModule(enabled)
SearchModule.prototype.Enter_search_string = function(str, diveno) SearchModule.prototype.Enter_search_string = function(str, diveno)
{ {
if (str == "" || !str) if (str === "" || !str)
return; return;
var res = str.toLowerCase().split(" "); var res = str.toLowerCase().split(" ");
for (var i = 0; i < res.length; i++) { for (var i = 0; i < res.length; i++) {
@ -672,7 +672,7 @@ var plot1;
function lastNonZero() function lastNonZero()
{ {
for(var i = items[dive_id].samples.length-1; i >= 0; i--){ for(var i = items[dive_id].samples.length-1; i >= 0; i--){
if(items[dive_id].samples[i][2] != 0) if(items[dive_id].samples[i][2] !== 0)
return items[dive_id].samples[i][2]; return items[dive_id].samples[i][2];
} }
} }
@ -846,20 +846,20 @@ function canvas_draw()
items[dive_id].samples[i][0] / 60, items[dive_id].samples[i][0] / 60,
-1 * mm_to_meter(items[dive_id].samples[i][1]) -1 * mm_to_meter(items[dive_id].samples[i][1])
]); ]);
if (items[dive_id].samples[i][2] != 0) { if (items[dive_id].samples[i][2] !== 0) {
pressureData.push([ pressureData.push([
items[dive_id].samples[i][0] / 60, items[dive_id].samples[i][0] / 60,
mbar_to_bar(items[dive_id].samples[i][2]) mbar_to_bar(items[dive_id].samples[i][2])
]); ]);
} }
if (items[dive_id].samples[i][3] != 0) { if (items[dive_id].samples[i][3] !== 0) {
temperatureData.push([ temperatureData.push([
items[dive_id].samples[i][0] / 60, items[dive_id].samples[i][0] / 60,
mkelvin_to_C(items[dive_id].samples[i][3]), mkelvin_to_C(items[dive_id].samples[i][3]),
]); ]);
last = items[dive_id].samples[i][3]; last = items[dive_id].samples[i][3];
} else { } else {
if (last != 0) { if (last !== 0) {
temperatureData.push([ temperatureData.push([
items[dive_id].samples[i][0] / 60, items[dive_id].samples[i][0] / 60,
mkelvin_to_C(last), mkelvin_to_C(last),