work around a firefox bug when calculation search width. fixes #944
This commit is contained in:
parent
31101764ff
commit
5ae70eca5f
@ -2220,7 +2220,8 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
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.resizeSearch();
|
// we could call this.resizeSearch(), but we do not because that requires a sizer and we do not want to create one so early because of a firefox bug, see #944
|
||||||
|
this.search.width(this.getMaxSearchWidth());
|
||||||
} else {
|
} else {
|
||||||
this.search.val("").width(10);
|
this.search.val("").width(10);
|
||||||
}
|
}
|
||||||
@ -2447,6 +2448,11 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// multi
|
||||||
|
getMaxSearchWidth: function() {
|
||||||
|
return this.selection.width() - getSideBorderPadding(this.search);
|
||||||
|
},
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
resizeSearch: function () {
|
resizeSearch: function () {
|
||||||
var minimumWidth, left, maxWidth, containerLeft, searchWidth,
|
var minimumWidth, left, maxWidth, containerLeft, searchWidth,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user