# HG changeset patch # User Nicholas Jillings # Date 1489220048 0 # Node ID a005429f575b2f83cededf7e4b877da334de3456 # Parent e4e7211842ad9981b90d4bcd80daf1c722c7e7b4 #180. specification.js passes JSHint diff -r e4e7211842ad -r a005429f575b js/specification.js --- a/js/specification.js Sat Mar 11 08:09:57 2017 +0000 +++ b/js/specification.js Sat Mar 11 08:14:08 2017 +0000 @@ -72,7 +72,6 @@ case "short": attribute = Number(attribute); break; - case "string": default: attribute = String(attribute); break; @@ -315,7 +314,7 @@ node.setAttribute("max", this.max); } else { node.setAttribute("max", "undefined"); - } + } /* falls through */ case "radio": for (var i = 0; i < this.options.length; i++) { var option = this.options[i]; @@ -344,7 +343,7 @@ case "video": if (this.mandatory !== undefined) { node.setAttribute("mandatory", this.mandatory); - } + } /* falls through */ case "youtube": if (this.url !== undefined) { node.setAttribute("url", this.url); @@ -363,6 +362,7 @@ maxText.textContent = this.rightText; node.appendChild(maxText); } + break; default: break; } @@ -691,9 +691,10 @@ this.step = undefined; break; case "commentquestion": - default: this.type = "question"; break; + default: + throw ("Unknown comment type " + xml.nodeName); } this.statement = xml.getElementsByTagName('statement')[0].textContent; if (this.type == "radio" || this.type == "checkbox") { @@ -745,9 +746,10 @@ node = root.createElement("commentslider"); break; case "question": - default: node = root.createElement("commentquestion"); break; + default: + throw ("Unknown type " + this.type); } node.id = this.id; node.setAttribute("type", this.type);