1
0
mirror of synced 2025-02-04 14:19:23 +03:00

fix firefox caret bug. closes #153

This commit is contained in:
Igor Vaynberg 2012-06-29 22:38:34 -07:00
parent 4ddcc52635
commit 83c11b27df

View File

@ -476,7 +476,7 @@
installKeyUpChangeEvent(search); installKeyUpChangeEvent(search);
search.bind("keyup-change", this.bind(this.updateResults)); search.bind("keyup-change", this.bind(this.updateResults));
search.bind("focus", function () { search.addClass("select2-focused");}); search.bind("focus", function () { search.addClass("select2-focused"); search.val(""); });
search.bind("blur", function () { search.removeClass("select2-focused");}); search.bind("blur", function () { search.removeClass("select2-focused");});
this.dropdown.delegate(resultsSelector, "click", this.bind(function (e) { this.dropdown.delegate(resultsSelector, "click", this.bind(function (e) {
@ -1527,6 +1527,8 @@
// 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.getContainerWidth()); this.search.width(this.getContainerWidth());
} else { } else {
// 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
this.search.val(" ").width(10); this.search.val(" ").width(10);
} }
}, },