diff --git a/packages/multiple-select-vanilla/src/MultipleSelectInstance.ts b/packages/multiple-select-vanilla/src/MultipleSelectInstance.ts index 194160f2..43006d53 100644 --- a/packages/multiple-select-vanilla/src/MultipleSelectInstance.ts +++ b/packages/multiple-select-vanilla/src/MultipleSelectInstance.ts @@ -18,6 +18,7 @@ import { getComputedSize, getOffset, getSize, + htmlDecode, insertAfter, toggleElement, } from './utils/domUtils.js'; @@ -1487,7 +1488,7 @@ export class MultipleSelectInstance { if (this.isRenderAsHtml) { elmOrProp.innerHTML = (typeof this.options.sanitizer === 'function' ? this.options.sanitizer(value) : value) as unknown as string; } else { - elmOrProp.textContent = value; + elmOrProp.textContent = htmlDecode(value); } } diff --git a/packages/multiple-select-vanilla/src/utils/domUtils.ts b/packages/multiple-select-vanilla/src/utils/domUtils.ts index 41e5d8ad..7a0e6eb3 100644 --- a/packages/multiple-select-vanilla/src/utils/domUtils.ts +++ b/packages/multiple-select-vanilla/src/utils/domUtils.ts @@ -1,5 +1,5 @@ import type { HtmlStruct, InferDOMType } from '../models/interfaces.js'; -import { objectRemoveEmptyProps } from './utils.js'; +import { isDefined, objectRemoveEmptyProps } from './utils.js'; export interface HtmlElementPosition { top: number; @@ -228,6 +228,23 @@ export function findParent(elm: HTMLElement, selector: string) { return targetElm; } +/** + * Simple function to decode the most common HTML entities. + * For example: "<div>Hablar español? </div>" => "