1
0
mirror of synced 2024-11-23 05:26:10 +03:00

remove the val(' ').val('') work around in firefox as it is no longer needed. fixes #832

This commit is contained in:
Igor Vaynberg 2013-02-08 21:53:43 -08:00
parent 90998d8442
commit 640e7066d9

View File

@ -630,7 +630,7 @@ the specific language governing permissions and limitations under the Apache Lic
installKeyUpChangeEvent(search); installKeyUpChangeEvent(search);
search.bind("keyup-change input", this.bind(this.updateResults)); search.bind("keyup-change input", this.bind(this.updateResults));
search.bind("focus", function () { search.addClass("select2-focused"); if (search.val() === " ") search.val(""); }); search.bind("focus", function () { search.addClass("select2-focused"); });
search.bind("blur", function () { search.removeClass("select2-focused");}); search.bind("blur", function () { search.removeClass("select2-focused");});
this.dropdown.delegate(resultsSelector, "mouseup", this.bind(function (e) { this.dropdown.delegate(resultsSelector, "mouseup", this.bind(function (e) {
@ -1039,8 +1039,6 @@ the specific language governing permissions and limitations under the Apache Lic
this.clearDropdownAlignmentPreference(); this.clearDropdownAlignmentPreference();
if (this.search.val() === " ") { this.search.val(""); }
this.container.addClass("select2-dropdown-open").addClass("select2-container-active"); this.container.addClass("select2-dropdown-open").addClass("select2-container-active");
@ -2096,9 +2094,7 @@ the specific language governing permissions and limitations under the Apache Lic
// 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.resizeSearch(); this.resizeSearch();
} else { } else {
// we set this to " " instead of "" and later clear it on focus() because there is a firefox bug this.search.val("").width(10);
// that does not properly render the caret when the field starts out blank
this.search.val(" ").width(10);
} }
}, },
@ -2106,9 +2102,6 @@ the specific language governing permissions and limitations under the Apache Lic
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("");
} }
}, },