소스 검색

small code cleanup

Igor Vaynberg 13 년 전
부모
커밋
eddc40934c
1개의 변경된 파일10개의 추가작업 그리고 7개의 파일을 삭제
  1. 10 7
      select2.js

+ 10 - 7
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