bootstrap-select
bootstrap-select copied to clipboard
Placeholder Attribute of Select Doesn't Allow For Custom Content.
The new addition of the placeholder attribute on the select tag doesn't seem to allow custom html content the same way the old title attribute used to on the select itself. Here's a quick demo of the two differences:
Version 1.13.5 (bootstrap 4) Version 1.14.0-beta2 (bootstrap 5)
Browsing the beta 2 code, I couldn't find anywhere in there where placeholder property would have the option to go through the sanitization to allow it to use HTML. Couldn't tell if this was a bug or just something I had missed the documentation on.
Playing around I found that changing line ~1933 (Changing the text
property to content
) will work for my small use case, but that only solves it when I'm using a static format.
if (this.options.selectedTextFormat === 'static') {
titleFragment = generateOption.text.call(this, { text: this.options.placeholder }, true);
} else {
to
if (this.options.selectedTextFormat === 'static') {
titleFragment = generateOption.text.call(this, { content: this.options.placeholder }, true);
} else {
Thanks for any help!
It may be the same problem here
In previous versions I have used SVG icons in option title="<svg...>" but now < > chars seems escaped?