Skip to content

Commit 4dce07a

Browse files
committed
fix usecase when a placeholder is not defined but an option with an empty value exists. fixes select2#1573
1 parent bb85b6a commit 4dce07a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

select2.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,11 +2083,11 @@ the specific language governing permissions and limitations under the Apache Lic
20832083

20842084
isPlaceholderOptionSelected: function() {
20852085
var placeholderOption;
2086-
return this.opts.placeholder &&
2087-
((placeholderOption = this.getPlaceholderOption()) !== undefined && placeholderOption.is(':selected')) ||
2088-
(this.opts.element.val() === "") ||
2089-
(this.opts.element.val() === undefined) ||
2090-
(this.opts.element.val() === null);
2086+
if (!this.opts.placeholder) return false; // no placeholder specified so no option should be considered
2087+
return ((placeholderOption = this.getPlaceholderOption()) !== undefined && placeholderOption.is(':selected'))
2088+
|| (this.opts.element.val() === "")
2089+
|| (this.opts.element.val() === undefined)
2090+
|| (this.opts.element.val() === null);
20912091
},
20922092

20932093
// single

0 commit comments

Comments
 (0)