Choices-js / Choices

A vanilla JS customisable select box/text input plugin ⚡️
https://choices-js.github.io/Choices/
MIT License
6.05k stars 597 forks source link

Wrong handling of ampersand in option text #1138

Closed jprusch closed 2 months ago

jprusch commented 7 months ago

Ampersand is HTML-escaped without need ( & -> & amp;)

To Reproduce Create a single select like:

<select name="search" class="choiceselect">
    <option value="1234">K&K</option>                                   
</select>

Check the rendered list. It displays as K& amp;K

Remark: I intentionally added a space after & to get this rendered correctly in github.

Generated HTML is:

<div id="choices--search-x1-item-choice-1" class="choices__item choices__item--choice choices__item--selectable is-highlighted"
   role="option" data-choice="" data-id="1" data-value="1234" data-select-text="" 
   data-choice-selectable="" aria-selected="true">K&amp;K</div>

Expected behavior The select option displays: K&K

All browser & platforms affected (Windows /Chrome&Edge, iOS Safari)

image
Tridus commented 4 months ago

I'm seeing this issue as well.

lucaspedreira commented 2 months ago

allowHTML: true

jprusch commented 2 months ago

Thx, solved the issue