$document
instead of document
JS-055528 if (vote < 0) {
29 document.getElementById("vote").setCustomValidity("Please enter a positive number.");
30 } else {
31 document.getElementById("vote").setCustomValidity("");32 }
33});
26document.getElementById("vote").addEventListener("input", () => {
27 const vote = parseFloat(document.getElementById("vote").value);
28 if (vote < 0) {
29 document.getElementById("vote").setCustomValidity("Please enter a positive number.");30 } else {
31 document.getElementById("vote").setCustomValidity("");
32 }
24});
25
26document.getElementById("vote").addEventListener("input", () => {
27 const vote = parseFloat(document.getElementById("vote").value);28 if (vote < 0) {
29 document.getElementById("vote").setCustomValidity("Please enter a positive number.");
30 } else {
23 document.getElementById("vote").value = "";
24});
25
26document.getElementById("vote").addEventListener("input", () => {27 const vote = parseFloat(document.getElementById("vote").value);
28 if (vote < 0) {
29 document.getElementById("vote").setCustomValidity("Please enter a positive number.");
20 return;
21 }
22 castVote(vote);
23 document.getElementById("vote").value = "";24});
25
26document.getElementById("vote").addEventListener("input", () => {
Instead of the default document object, you should prefer the AngularJS wrapper service $document.
Rule based on Angular 1.x
// invalid
document.title // error: You should use the $document service instead of the default document object
// valid
$document[0].title = ""