Correctly handle XML in KoralQuery highlighter

Change-Id: Id3f53e8409c2f898c6585e58e0a66563aeec0d13
diff --git a/dev/js/runner/all.html b/dev/js/runner/all.html
index d2d6f25..124cb76 100644
--- a/dev/js/runner/all.html
+++ b/dev/js/runner/all.html
@@ -41,6 +41,7 @@
         'spec/menuSpec',
         'spec/selectMenuSpec',
         'spec/panelSpec',
+        'spec/kqViewSpec',
         'spec/pluginSpec',
         'spec/queryCreatorSpec',
         'spec/corpusByMatchSpec',
diff --git a/dev/js/spec/kqViewSpec.js b/dev/js/spec/kqViewSpec.js
new file mode 100644
index 0000000..3870324
--- /dev/null
+++ b/dev/js/spec/kqViewSpec.js
@@ -0,0 +1,37 @@
+define(['view/result/koralquery','util'], function (kqClass) {
+  describe('KorAP.View.Result.KoralQuery', function () {
+
+    beforeEach(
+      function () {
+       KorAP.koralQuery = {} 
+      }
+    );
+
+    afterEach(
+      function () {
+        KorAP.koralQuery = {} 
+      }
+    );
+    
+    it('should be initializable', function () {
+      KorAP.koralQuery = {
+        "test" : "cool"
+      };
+      var kq = kqClass.create();
+      var content = kq.element().firstChild.textContent;
+      expect(content).toMatch(/test/);
+      expect(content).toMatch(/cool/);
+    });
+
+    it('should deal with XML fragments', function () {
+      KorAP.koralQuery = {
+        "test" : "Das ist <b>Super!</b>"
+      };
+      var kq = kqClass.create();
+      var content = kq.element().firstChild.textContent;
+      expect(content).toMatch(/test/);
+      expect(content).toMatch(/Das ist <b>Super!<\/b>/);
+    });
+
+  });
+});
diff --git a/dev/js/src/view/result/koralquery.js b/dev/js/src/view/result/koralquery.js
index 6060bb8..c456eee 100644
--- a/dev/js/src/view/result/koralquery.js
+++ b/dev/js/src/view/result/koralquery.js
@@ -18,8 +18,11 @@
       kq.setAttribute('id', 'koralquery');
 
       var kqInner = kq.addE('div');
-      kqInner.innerHTML = JSON.stringify(KorAP.koralQuery || {}, null, '  ');
 
+      kqInner.addT(
+        JSON.stringify(KorAP.koralQuery || {}, null, '  ')
+      );
+      
       // Highlight the view
       hljs.highlightBlock(kqInner);