diff --git a/select2.js b/select2.js index 6fbfa62e..981f1d85 100755 --- a/select2.js +++ b/select2.js @@ -806,26 +806,34 @@ if (!this.shouldOpen()) return false; + window.setTimeout(this.bind(this.opening), 1); + + return true; + }, + + /** + * Performs the opening of the dropdown + */ + // abstract + opening: function() { this.clearDropdownAlignmentPreference(); if (this.search.val() === " ") { this.search.val(""); } - this.container.addClass("select2-dropdown-open").addClass("select2-container-active"); - if(this.dropdown[0] !== this.body.children().last()[0]) { - // ensure the dropdown is the last child of body, so the z-index is always respected correctly - this.dropdown.detach().appendTo(this.body); - } - this.dropdown.addClass("select2-drop-active"); this.positionDropdown(); this.updateResults(true); + + if(this.dropdown[0] !== this.body.children().last()[0]) { + this.dropdown.detach().appendTo(this.body); + } + this.dropdown.show(); this.ensureHighlightVisible(); this.focusSearch(); - - return true; + this.container.addClass("select2-dropdown-open").addClass("select2-container-active"); }, // abstract @@ -1132,11 +1140,11 @@ "class": "select2-container", "style": "width: " + this.getContainerWidth() }).html([ - " ", + " ", " ", "
" , "
", - "