You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When there are HTML comments within select options, this content is copied into the choices items.
For my particular use case, the initial select and option tags are generated by Lit which adds some metadata in the form of HTML comments to manage dynamic content.
E.g.
<select id="choices-example" class="form-control" placeholder="This is a placeholder" multiple>
<option value="">
<!-- HTML comment 1 -->
Select an option
</option>
<option value="dog">
<!-- HTML comment 2 -->
Dog
</option>
</select>
<script>
document.addEventListener('DOMContentLoaded', function() {
let choicesConfig = new Choices('#choices-example');
});
</script>
Expected behavior
I would expect that any non-text content within the options would be filtered out.
Describe the bug
When there are HTML comments within select options, this content is copied into the choices items.
For my particular use case, the initial select and option tags are generated by Lit which adds some metadata in the form of HTML comments to manage dynamic content.
E.g.
To Reproduce
I've made a minimal reproduction in Codepen: https://codepen.io/actuallyacat/pen/WbeNWeg
Or you can refer to this snippet:
Expected behavior
I would expect that any non-text content within the options would be filtered out.
Screenshots

Choices version and bundle
https://www.jsdelivr.com/package/npm/choices.js
The text was updated successfully, but these errors were encountered: