changeset 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 b3c0fcd60a29
files js/core.js
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/js/core.js	Mon Sep 25 11:00:05 2017 +0100
+++ b/js/core.js	Mon Sep 25 11:47:06 2017 +0100
@@ -1082,7 +1082,15 @@
         lastNodeStart = new Date();
         this.popupResponse.innerHTML = "";
         this.popupTitle.innerHTML = "";
-        this.popupTitle.appendChild(p.parseFromString(converter.makeHtml(node.specification.statement), "text/html").getElementsByTagName("body")[0].firstElementChild);
+        var strings = node.specification.statement.split("\n");
+        strings.forEach(function(e,i,a){
+            a[i] = e.trim();
+        });
+        node.specification.statement = strings.join("\n");
+        var statementElements = p.parseFromString(converter.makeHtml(node.specification.statement), "text/html").querySelector("body").children;
+        while(statementElements.length > 0) {
+            this.popupTitle.appendChild(statementElements[0]);
+        }
         if (node.specification.type == 'question') {
             postQuestion.call(this, node);
         } else if (node.specification.type == 'checkbox') {