diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-03-03 18:06:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-03 18:06:12 -0500 |
commit | ca4d5a2ac19d1e97025b579157568fb1e9fa0701 (patch) | |
tree | 6004a9c78808eba724d7905e4c468edd75ec54ce | |
parent | 14717b7579c2144a602fdfcf8c5ba27de6ca5d80 (diff) |
Fix text being overwritten when generating the query parser content (#1483)
-rw-r--r-- | ext/js/display/query-parser.js | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/ext/js/display/query-parser.js b/ext/js/display/query-parser.js index c21033de..8c5ce331 100644 --- a/ext/js/display/query-parser.js +++ b/ext/js/display/query-parser.js @@ -149,7 +149,7 @@ class QueryParser extends EventDispatcher { this._queryParser.textContent = ''; this._queryParser.dataset.parsed = 'true'; if (!parseResult) { return; } - this._queryParser.appendChild(this._createParseResult(parseResult.content, false)); + this._queryParser.appendChild(this._createParseResult(parseResult.content)); } _updateParserModeSelect(select, parseResults, selectedParser) { @@ -191,7 +191,7 @@ class QueryParser extends EventDispatcher { termNode.className = 'query-parser-term'; for (const segment of term) { if (segment.reading.trim().length === 0) { - this._addSegmentText(segment.text, termNode); + termNode.appendChild(document.createTextNode(segment.text)); } else { termNode.appendChild(this._createSegment(segment)); } @@ -214,13 +214,9 @@ class QueryParser extends EventDispatcher { segmentNode.appendChild(textNode); segmentNode.appendChild(readingNode); - this._addSegmentText(segment.text, textNode); + textNode.textContent = segment.text; readingNode.textContent = segment.reading; return segmentNode; } - - _addSegmentText(text, container) { - container.textContent = text; - } } |