gfranko / jquery.selectBoxIt.js

A jQuery Select Box Plugin for Mobile, Tablet, and Desktop
http://www.selectboxit.com
MIT License
852 stars 301 forks source link

html option has no effect on optgroup labels #373

Open maxklinger opened 7 years ago

maxklinger commented 7 years ago

selectBoxIt provides the html option (http://gregfranko.com/jquery.selectBoxIt.js/#Options) to specify whether the dropdown's content should be rendered as HTML or text. While this works great with option texts this has no effect on the labels of optgroups, even if the labels are already escaped in the original select element. To fix this, I'd suggest that the following line in _createUnorderedList

optgroupElement = '<span class="selectboxit-optgroup-header ' + parent.first().attr("class") + '"data-disabled="true">' + parent.first().attr("label") + '</span>';

be changed to

optgroupElement = '<span class="selectboxit-optgroup-header ' + parent.first().attr("class") + '"data-disabled="true">' + (self.options["html"] ? parent.first().attr("label") : self.htmlEscape(parent.first().attr("label"))) + '</span>';

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/42317612-html-option-has-no-effect-on-optgroup-labels?utm_campaign=plugin&utm_content=tracker%2F23157&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F23157&utm_medium=issues&utm_source=github).