瀏覽代碼

fix options with empty values. fixes #1497

Igor Vaynberg 12 年之前
父節點
當前提交
1f09c7abaf
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      select2.js

+ 3 - 2
select2.js

@@ -1,4 +1,4 @@
-/*
+/*
 Copyright 2012 Igor Vaynberg
 
 Version: @@ver@@ Timestamp: @@timestamp@@
@@ -2057,7 +2057,8 @@ the specific language governing permissions and limitations under the Apache Lic
 
         isPlaceholderOptionSelected: function() {
             var placeholderOption;
-            return ((placeholderOption = this.getPlaceholderOption()) !== undefined && placeholderOption.is(':selected')) ||
+            return this.opts.placeholder &&
+                ((placeholderOption = this.getPlaceholderOption()) !== undefined && placeholderOption.is(':selected')) ||
                    (this.opts.element.val() === "") ||
                    (this.opts.element.val() === undefined) ||
                    (this.opts.element.val() === null);