bootstrap-select icon indicating copy to clipboard operation
bootstrap-select copied to clipboard

🤔Bug: Title tag doesn't support HTML/data-icon (anymore)

Open mikeploeger opened this issue 5 years ago • 2 comments

Problem: Until 1.13.5 this was working to add custom icons to the select title:

<select title="<i class='my-icon'></i>">

But since everything gets escaped now (https://github.com/snapappointments/bootstrap-select/commit/9c0dc0dc06258c5993be3e5048b8919377a704ec), its not working anymore.

How can we add html to the title of the option tag? (For example for icons, like before)

"Hacky" workaround:

I've removed the title and data-selected-text-format attribute:

<select
title="<i class='icons icon-show'></I>DoSomething"
data-selected-text-format="static"...

And I'am using instead:

<select ...>
    <option data-icon="icon-show" data-hidden="true">DoSomething</option>

But this doesnt work very well if things get selected.. because the selected items overwrite the "workaround" title.

Possible Solution: I think the best solution to this problem would be one of the following:

1.) Add a option to disable html removal / sanitizing completely. OR 2.) Add <select data-icon=""> attribute, like you did it with <option data-icon""> elements.


Currently, data-content= and data-icon= doesnt work for the <select> element to display a icon. (like they do on an <option> element)

The disability to show icons on the <select title=""> is the reason why I'am now stuck on 1.13.5.

Btw. thank you for your outstanding work! @caseyjhol

mikeploeger avatar Feb 08 '20 04:02 mikeploeger

Would be great to have support for HTML for option.title as well! (See workaround in #2640)

kennysong avatar Aug 07 '21 02:08 kennysong

Any updates on this topic? @caseyjhol

mikeploeger avatar Oct 10 '22 20:10 mikeploeger