From eddc40934c80746633751aafe41b9cc9dfd16e1b Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Thu, 29 Mar 2012 11:43:39 -0700 Subject: [PATCH] small code cleanup --- select2.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/select2.js b/select2.js index abb5b979..60fe446d 100755 --- a/select2.js +++ b/select2.js @@ -772,8 +772,10 @@ }; SingleSelect2.prototype.updateSelection = function (data) { - this.selection.find("span").html(this.opts.formatSelection(data)); - this.selection.removeClass("select2-default"); + this.selection + .find("span") + .html(this.opts.formatSelection(data)) + .removeClass("select2-default"); if (this.opts.allowClear && this.getPlaceholder() !== undefined) { this.selection.find("abbr").show(); } @@ -790,11 +792,12 @@ if (this.select) { // val is an id - this.select.val(val); - this.select.find(":selected").each(function () { - data = {id: $(this).attr("value"), text: $(this).text()}; - return false; - }); + this.select + .val(val) + .find(":selected").each(function () { + data = {id: $(this).attr("value"), text: $(this).text()}; + return false; + }); this.updateSelection(data); } else { // val is an object