From 9bf38c833c2fc0868b90003b56fa0924108375dc Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Mon, 18 Jun 2012 20:18:51 -0700 Subject: [PATCH] renamed opts.elementBody to this.body for brevity --- select2.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/select2.js b/select2.js index a76836a7..b34e1b06 100755 --- a/select2.js +++ b/select2.js @@ -398,7 +398,9 @@ this.enabled=true; this.container = this.createContainer(); + this.body = opts.element.closest("body"); // cache for future access + if (opts.element.attr("class") !== undefined) { this.container.addClass(opts.element.attr("class")); } @@ -484,8 +486,6 @@ prepareOpts: function (opts) { var element, select, idKey; - opts.elementBody = opts.element.closest("body"); // cache for future access - element = opts.element; if (element.get(0).tagName.toLowerCase() === "select") { @@ -688,8 +688,9 @@ this.clearPlaceholder(); 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 - this.dropdown.detach().appendTo(this.opts.elementBody); + 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");