Use strict equality
This commit is contained in:
parent
907c296337
commit
2f50d1c22d
14
test.html
14
test.html
@ -57,7 +57,7 @@
|
|||||||
let election, elComment, elExhausted1, elExhausted2, elLTF1, elLTF2, elTotal, elQuota;
|
let election, elComment, elExhausted1, elExhausted2, elLTF1, elLTF2, elTotal, elQuota;
|
||||||
|
|
||||||
worker.onmessage = function(evt) {
|
worker.onmessage = function(evt) {
|
||||||
if (evt.data.type == 'init') {
|
if (evt.data.type === 'init') {
|
||||||
election = evt.data.election;
|
election = evt.data.election;
|
||||||
|
|
||||||
// Comment row
|
// Comment row
|
||||||
@ -133,7 +133,7 @@
|
|||||||
tblResults.appendChild(elQuota);
|
tblResults.appendChild(elQuota);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evt.data.type == 'result') {
|
if (evt.data.type === 'result') {
|
||||||
let result = evt.data.result;
|
let result = evt.data.result;
|
||||||
|
|
||||||
// Display results
|
// Display results
|
||||||
@ -146,9 +146,9 @@
|
|||||||
|
|
||||||
elTd = document.createElement('td');
|
elTd = document.createElement('td');
|
||||||
elTd.classList.add('count');
|
elTd.classList.add('count');
|
||||||
if (countCard.state == py.pyRCV2.model.CandidateState.WITHDRAWN || countCard.state == py.pyRCV2.model.CandidateState.EXCLUDED) {
|
if (countCard.state === py.pyRCV2.model.CandidateState.WITHDRAWN || countCard.state === py.pyRCV2.model.CandidateState.EXCLUDED) {
|
||||||
elTd.classList.add('excluded');
|
elTd.classList.add('excluded');
|
||||||
} else if (countCard.state == py.pyRCV2.model.CandidateState.ELECTED || countCard.state == py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED) {
|
} else if (countCard.state === py.pyRCV2.model.CandidateState.ELECTED || countCard.state === py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED) {
|
||||||
elTd.classList.add('elected');
|
elTd.classList.add('elected');
|
||||||
}
|
}
|
||||||
elTd.style.borderTop = '1px solid black';
|
elTd.style.borderTop = '1px solid black';
|
||||||
@ -159,16 +159,16 @@
|
|||||||
|
|
||||||
elTd = document.createElement('td');
|
elTd = document.createElement('td');
|
||||||
elTd.classList.add('count');
|
elTd.classList.add('count');
|
||||||
if (countCard.state == py.pyRCV2.model.CandidateState.WITHDRAWN) {
|
if (countCard.state === py.pyRCV2.model.CandidateState.WITHDRAWN) {
|
||||||
elTd.classList.add('excluded');
|
elTd.classList.add('excluded');
|
||||||
elTd.innerText = 'WD';
|
elTd.innerText = 'WD';
|
||||||
} else if (countCard.state == py.pyRCV2.model.CandidateState.ELECTED || countCard.state == py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED) {
|
} else if (countCard.state === py.pyRCV2.model.CandidateState.ELECTED || countCard.state === py.pyRCV2.model.CandidateState.PROVISIONALLY_ELECTED) {
|
||||||
elTd.classList.add('elected');
|
elTd.classList.add('elected');
|
||||||
elTd.innerText = countCard.votes;
|
elTd.innerText = countCard.votes;
|
||||||
elTd.style.fontWeight = 'bold';
|
elTd.style.fontWeight = 'bold';
|
||||||
|
|
||||||
elTr1.querySelector('td:first-child').classList.add('elected');
|
elTr1.querySelector('td:first-child').classList.add('elected');
|
||||||
} else if (countCard.state == py.pyRCV2.model.CandidateState.EXCLUDED) {
|
} else if (countCard.state === py.pyRCV2.model.CandidateState.EXCLUDED) {
|
||||||
elTd.classList.add('excluded');
|
elTd.classList.add('excluded');
|
||||||
elTd.innerText = 'EX';
|
elTd.innerText = 'EX';
|
||||||
} else {
|
} else {
|
||||||
|
@ -5,16 +5,16 @@ function sleep(ms) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onmessage = async function(evt) {
|
onmessage = async function(evt) {
|
||||||
if (evt.data.numbers == 'native') {
|
if (evt.data.numbers === 'native') {
|
||||||
py.pyRCV2.numbers.set_numclass(py.pyRCV2.numbers.Native);
|
py.pyRCV2.numbers.set_numclass(py.pyRCV2.numbers.Native);
|
||||||
}
|
}
|
||||||
if (evt.data.numbers == 'int') {
|
if (evt.data.numbers === 'int') {
|
||||||
py.pyRCV2.numbers.set_numclass(py.pyRCV2.numbers.NativeInt);
|
py.pyRCV2.numbers.set_numclass(py.pyRCV2.numbers.NativeInt);
|
||||||
}
|
}
|
||||||
if (evt.data.numbers == 'rational') {
|
if (evt.data.numbers === 'rational') {
|
||||||
py.pyRCV2.numbers.set_numclass(py.pyRCV2.numbers.Rational);
|
py.pyRCV2.numbers.set_numclass(py.pyRCV2.numbers.Rational);
|
||||||
}
|
}
|
||||||
if (evt.data.numbers == 'fixed') {
|
if (evt.data.numbers === 'fixed') {
|
||||||
py.pyRCV2.numbers.set_numclass(py.pyRCV2.numbers.Fixed);
|
py.pyRCV2.numbers.set_numclass(py.pyRCV2.numbers.Fixed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user