|
@@ -1487,6 +1487,7 @@
|
|
|
|
|
|
this.container.delegate(selector, "click", this.bind(function (e) {
|
|
this.container.delegate(selector, "click", this.bind(function (e) {
|
|
if (!this.enabled) return;
|
|
if (!this.enabled) return;
|
|
|
|
+ this.clearPlaceholder();
|
|
this.open();
|
|
this.open();
|
|
this.focusSearch();
|
|
this.focusSearch();
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
@@ -1550,7 +1551,7 @@
|
|
if (placeholder !== undefined && this.getVal().length === 0 && this.search.hasClass("select2-focused") === false) {
|
|
if (placeholder !== undefined && this.getVal().length === 0 && this.search.hasClass("select2-focused") === false) {
|
|
this.search.val(placeholder).addClass("select2-default");
|
|
this.search.val(placeholder).addClass("select2-default");
|
|
// stretch the search box to full width of the container so as much of the placeholder is visible as possible
|
|
// stretch the search box to full width of the container so as much of the placeholder is visible as possible
|
|
- this.search.width(this.container.width());
|
|
|
|
|
|
+ this.search.width("auto");
|
|
} else {
|
|
} else {
|
|
// we set this to " " instead of "" and later clear it on focus() because there is a firefox bug
|
|
// we set this to " " instead of "" and later clear it on focus() because there is a firefox bug
|
|
// that does not properly render the caret when the field starts out blank
|
|
// that does not properly render the caret when the field starts out blank
|
|
@@ -1562,6 +1563,9 @@
|
|
clearPlaceholder: function () {
|
|
clearPlaceholder: function () {
|
|
if (this.search.hasClass("select2-default")) {
|
|
if (this.search.hasClass("select2-default")) {
|
|
this.search.val("").removeClass("select2-default");
|
|
this.search.val("").removeClass("select2-default");
|
|
|
|
+ } else {
|
|
|
|
+ // work around for the space character we set to avoid firefox caret bug
|
|
|
|
+ if (this.search.val() === " ") this.search.val("");
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|