Skip to content

Commit ab39099

Browse files
committed
Autocomplete: More verbose checking for multi-line to work around IE treating inputs as contentEditable.
1 parent 405cbef commit ab39099

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

ui/jquery.ui.autocomplete.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ $.widget( "ui.autocomplete", {
5555
// search term. #7799
5656
var suppressKeyPress, suppressKeyPressRepeat, suppressInput;
5757

58-
this.isMultiLine = this.element.is( "textarea" ) || this.element.prop( "isContentEditable" );
58+
this.isMultiLine = this._isMultiLine();
5959
this.valueMethod = this.element[ this.element.is( "input,textarea" ) ? "val" : "text" ];
6060
this.isNewMenu = true;
6161

@@ -326,6 +326,20 @@ $.widget( "ui.autocomplete", {
326326
}
327327
},
328328

329+
_isMultiLine: function() {
330+
// Textareas are always multi-line
331+
if ( this.element.is( "textarea" ) ) {
332+
return true;
333+
}
334+
// Inputs are always single-line, even if inside a contentEditable element
335+
// IE also treats inputs as contentEditable
336+
if ( this.element.is( "input" ) ) {
337+
return false;
338+
}
339+
// All other element types are determined by whether or not they're contentEditable
340+
return this.element.prop( "isContentEditable" );
341+
},
342+
329343
_initSource: function() {
330344
var array, url,
331345
that = this;

0 commit comments

Comments
 (0)