Skip to content

Commit

Permalink
Fixes newlines not being highlighted and inserted weirdly in table #1
Browse files Browse the repository at this point in the history
  • Loading branch information
klovaaxel committed Feb 2, 2024
1 parent 7a094e4 commit dea789a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/combobox-framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit dea789a

Please sign in to comment.