diff --git a/select2.js b/select2.js index 6fb443e9..5822094d 100644 --- a/select2.js +++ b/select2.js @@ -2087,7 +2087,7 @@ the specific language governing permissions and limitations under the Apache Lic // single updateSelection: function (data) { - var container=this.selection.find("span"), formatted; + var container=this.selection.find("span"), formatted, cssClass; this.selection.data("select2-data", data); @@ -2096,6 +2096,10 @@ the specific language governing permissions and limitations under the Apache Lic if (formatted !== undefined) { container.append(this.opts.escapeMarkup(formatted)); } + cssClass=this.opts.formatSelectionCssClass(data, container); + if (cssClass !== undefined) { + container.addClass(cssClass); + } this.selection.removeClass("select2-default"); @@ -2632,12 +2636,17 @@ the specific language governing permissions and limitations under the Apache Lic var choice = enableChoice ? enabledItem : disabledItem, id = this.id(data), val = this.getVal(), - formatted; + formatted, + cssClass; formatted=this.opts.formatSelection(data, choice.find("div")); if (formatted != undefined) { choice.find("div").replaceWith("