From dea789a37153124ca3fb59ccb587023ac9e6925d Mon Sep 17 00:00:00 2001 From: klovaaxel Date: Fri, 2 Feb 2024 19:58:01 +0100 Subject: [PATCH] Fixes newlines not being highlighted and inserted weirdly in table #1 --- src/combobox-framework.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/combobox-framework.ts b/src/combobox-framework.ts index 30386fd..b1ba567 100644 --- a/src/combobox-framework.ts +++ b/src/combobox-framework.ts @@ -310,7 +310,12 @@ export default class ComboboxFramework extends HTMLElement { // #region Highlight the search string in the list items (or nested childrens) text content const highlightTextContent = (node: Element) => { - if (node.nodeType === Node.TEXT_NODE) { + if ( + node.nodeType === Node.TEXT_NODE && + node.textContent?.trim() != "" && + node.textContent?.trim() != "\n" + ) { + console.log(node); const text = node.textContent ?? ""; const newNode = document.createElement("template"); newNode.innerHTML = this.highlightText(text, this._input!.value);