comparison js/core.js @ 2943:49b0b1e245af

Fix #242
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Mon, 25 Sep 2017 11:47:06 +0100
parents 8c7d5ee1b906
children 311596aedb7b 25177b93616f
comparison
equal deleted inserted replaced
2942:8c7d5ee1b906 2943:49b0b1e245af
1080 converter = new showdown.Converter(), 1080 converter = new showdown.Converter(),
1081 p = new DOMParser(); 1081 p = new DOMParser();
1082 lastNodeStart = new Date(); 1082 lastNodeStart = new Date();
1083 this.popupResponse.innerHTML = ""; 1083 this.popupResponse.innerHTML = "";
1084 this.popupTitle.innerHTML = ""; 1084 this.popupTitle.innerHTML = "";
1085 this.popupTitle.appendChild(p.parseFromString(converter.makeHtml(node.specification.statement), "text/html").getElementsByTagName("body")[0].firstElementChild); 1085 var strings = node.specification.statement.split("\n");
1086 strings.forEach(function(e,i,a){
1087 a[i] = e.trim();
1088 });
1089 node.specification.statement = strings.join("\n");
1090 var statementElements = p.parseFromString(converter.makeHtml(node.specification.statement), "text/html").querySelector("body").children;
1091 while(statementElements.length > 0) {
1092 this.popupTitle.appendChild(statementElements[0]);
1093 }
1086 if (node.specification.type == 'question') { 1094 if (node.specification.type == 'question') {
1087 postQuestion.call(this, node); 1095 postQuestion.call(this, node);
1088 } else if (node.specification.type == 'checkbox') { 1096 } else if (node.specification.type == 'checkbox') {
1089 postCheckbox.call(this, node); 1097 postCheckbox.call(this, node);
1090 } else if (node.specification.type == 'radio') { 1098 } else if (node.specification.type == 'radio') {