renamed opts.elementBody to this.body for brevity
This commit is contained in:
parent
693b541361
commit
9bf38c833c
@ -398,6 +398,8 @@
|
|||||||
|
|
||||||
this.enabled=true;
|
this.enabled=true;
|
||||||
this.container = this.createContainer();
|
this.container = this.createContainer();
|
||||||
|
this.body = opts.element.closest("body"); // cache for future access
|
||||||
|
|
||||||
|
|
||||||
if (opts.element.attr("class") !== undefined) {
|
if (opts.element.attr("class") !== undefined) {
|
||||||
this.container.addClass(opts.element.attr("class"));
|
this.container.addClass(opts.element.attr("class"));
|
||||||
@ -484,8 +486,6 @@
|
|||||||
prepareOpts: function (opts) {
|
prepareOpts: function (opts) {
|
||||||
var element, select, idKey;
|
var element, select, idKey;
|
||||||
|
|
||||||
opts.elementBody = opts.element.closest("body"); // cache for future access
|
|
||||||
|
|
||||||
element = opts.element;
|
element = opts.element;
|
||||||
|
|
||||||
if (element.get(0).tagName.toLowerCase() === "select") {
|
if (element.get(0).tagName.toLowerCase() === "select") {
|
||||||
@ -688,8 +688,9 @@
|
|||||||
this.clearPlaceholder();
|
this.clearPlaceholder();
|
||||||
|
|
||||||
this.container.addClass("select2-dropdown-open").addClass("select2-container-active");
|
this.container.addClass("select2-dropdown-open").addClass("select2-container-active");
|
||||||
if(this.dropdown[0] !== this.opts.elementBody.children().last()[0]) { // ensure our dropdown is the last eleemnt, so the z-index is always respected correctly
|
if(this.dropdown[0] !== this.body.children().last()[0]) {
|
||||||
this.dropdown.detach().appendTo(this.opts.elementBody);
|
// 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.dropdown.addClass("select2-drop-active");
|
||||||
|
Loading…
Reference in New Issue
Block a user