Skip to content

Commit 099fc0c

Browse files
committed
Only add wrapper class when it is not present
This allows us to already wrap a select in multiselect on page load, preventing flashed of unstyled content
1 parent 086e515 commit 099fc0c

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

dist/js/bootstrap-multiselect.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,13 @@
221221
this.disable();
222222
}
223223

224-
this.$select.wrap('<span class="multiselect-native-select" />').after(this.$container);
224+
// Only wrap the select in a multiselect span if it is not already contained.
225+
const wrapperClass = "multiselect-native-select";
226+
if (this.$select.parent().first().attr("class") !== wrapperClass) {
227+
this.$select.wrap(`<span class="${wrapperClass}" />`);
228+
}
229+
// Container is removed in the .destroy(), so always insert it.
230+
this.$select.after(this.$container);
225231
this.options.onInitialized(this.$select, this.$container);
226232
}
227233

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bootstrap-multiselect",
3-
"version": "0.10.01",
3+
"version": "0.10.02",
44
"description": "JQuery multiselect plugin based on Twitter Bootstrap.",
55
"main": "dist/js/bootstrap-multiselect.js",
66
"directories": {

0 commit comments

Comments
 (0)