This commit is contained in:
Stephan Porada 2020-04-15 15:11:25 +02:00
parent 68eb1d1972
commit 8b27ddf5d2

View File

@ -177,7 +177,7 @@ class ResultsList extends List {
);
}
HTMLTStroElement(htmlStr) {
HTMLTStrToElement(htmlStr) {
// https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
let template = document.createElement("template");
htmlStr = htmlStr.trim();
@ -229,7 +229,7 @@ class ResultsList extends List {
`data-cpos="${cpos}">` +
`${token.word}` +
`</span>`;
tokenHTMlElement = this.HTMLTStroElement(htmlTokenStr)
tokenHTMlElement = this.HTMLTStrToElement(htmlTokenStr)
tokenHTMLArray.push(tokenHTMlElement);
}
for (let cpos of c) {
@ -241,7 +241,7 @@ class ResultsList extends List {
`style="text-decoration-line: underline;">` +
`${token.word}` +
`</span>`;
tokenHTMlElement = this.HTMLTStroElement(htmlTokenStr)
tokenHTMlElement = this.HTMLTStrToElement(htmlTokenStr)
tokenHTMLArray.push(tokenHTMlElement);
}
for (let cpos of rc) {
@ -252,7 +252,7 @@ class ResultsList extends List {
`data-cpos="${cpos}">` +
`${token.word}` +
`</span>`;
tokenHTMlElement = this.HTMLTStroElement(htmlTokenStr)
tokenHTMlElement = this.HTMLTStrToElement(htmlTokenStr)
tokenHTMLArray.push(tokenHTMlElement);
}
console.log(tokenHTMLArray);
@ -260,8 +260,8 @@ class ResultsList extends List {
partElement = document.createElement("p");
for (let sId of uniqueS) {
let htmlSentence = `<div class="sentence s12" data-sid="${sId}">`;
let sentenceElement = this.HTMLTStroElement(htmlSentence);
let htmlSentence = `<div class="sentence" data-sid="${sId}"></div>`;
let sentenceElement = this.HTMLTStrToElement(htmlSentence);
for (let tokenElement of tokenHTMLArray) {
if (tokenElement.dataset.sid == sId) {
sentenceElement.appendChild(tokenElement);