CETEIcean 1.9.1 → 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "CETEIcean",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "description": "JavaScript library to load a TEI XML document and register it as HTML5 custom elements.",
5
5
  "main": "src/CETEI.js",
6
6
  "type": "module",
@@ -97,12 +97,14 @@ export default {
97
97
  "egXML": function(elt) {
98
98
  const doc = elt.ownerDocument;
99
99
  let pre = doc.createElement("pre");
100
+ let code = doc.createElement("code");
101
+ pre.appendChild(code);
100
102
  let content = this.serialize(elt, true).replace(/</g, "&lt;");
101
103
  let ws = content.match(/^[\t ]+/);
102
104
  if (ws) {
103
105
  content = content.replace(new RegExp("^" + ws[0], "mg"), "");
104
106
  }
105
- pre.innerHTML = content;
107
+ code.innerHTML = content;
106
108
  return pre;
107
109
  }
108
110
  }
package/src/utilities.js CHANGED
@@ -298,7 +298,7 @@ export function serializeHTML(el, stripElt, ws) {
298
298
  if ((typeof ws === "string") && ignorable(node.nodeValue)) {
299
299
  break;
300
300
  }
301
- str += node.nodeValue;
301
+ str += node.nodeValue.replace(/</g, "&lt;");
302
302
  }
303
303
  }
304
304
  if (!EMPTY_ELEMENTS.includes(el.nodeName)) {