Skip to content

Commit 9bf38c8

Browse files
author
Igor Vaynberg
committed
renamed opts.elementBody to this.body for brevity
1 parent 693b541 commit 9bf38c8

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

select2.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,9 @@
398398

399399
this.enabled=true;
400400
this.container = this.createContainer();
401+
this.body = opts.element.closest("body"); // cache for future access
401402

403+
402404
if (opts.element.attr("class") !== undefined) {
403405
this.container.addClass(opts.element.attr("class"));
404406
}
@@ -484,8 +486,6 @@
484486
prepareOpts: function (opts) {
485487
var element, select, idKey;
486488

487-
opts.elementBody = opts.element.closest("body"); // cache for future access
488-
489489
element = opts.element;
490490

491491
if (element.get(0).tagName.toLowerCase() === "select") {
@@ -688,8 +688,9 @@
688688
this.clearPlaceholder();
689689

690690
this.container.addClass("select2-dropdown-open").addClass("select2-container-active");
691-
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
692-
this.dropdown.detach().appendTo(this.opts.elementBody);
691+
if(this.dropdown[0] !== this.body.children().last()[0]) {
692+
// ensure the dropdown is the last child of body, so the z-index is always respected correctly
693+
this.dropdown.detach().appendTo(this.body);
693694
}
694695

695696
this.dropdown.addClass("select2-drop-active");

0 commit comments

Comments
 (0)