@@ -54,10 +54,21 @@ $.widget( "ui.autocomplete", {
54
54
// so we use the suppressKeyPressRepeat flag to avoid handling keypress
55
55
// events when we know the keydown event was used to modify the
56
56
// search term. #7799
57
- var suppressKeyPress , suppressKeyPressRepeat , suppressInput ;
58
-
59
- this . isMultiLine = this . _isMultiLine ( ) ;
60
- this . valueMethod = this . element [ this . element . is ( "input,textarea" ) ? "val" : "text" ] ;
57
+ var suppressKeyPress , suppressKeyPressRepeat , suppressInput ,
58
+ nodeName = this . element [ 0 ] . nodeName . toLowerCase ( ) ,
59
+ isTextarea = nodeName === "textarea" ,
60
+ isInput = nodeName === "input" ;
61
+
62
+ this . isMultiLine =
63
+ // Textareas are always multi-line
64
+ isTextarea ? true :
65
+ // Inputs are always single-line, even if inside a contentEditable element
66
+ // IE also treats inputs as contentEditable
67
+ isInput ? false :
68
+ // All other element types are determined by whether or not they're contentEditable
69
+ this . element . prop ( "isContentEditable" ) ;
70
+
71
+ this . valueMethod = this . element [ isTextarea || isInput ? "val" : "text" ] ;
61
72
this . isNewMenu = true ;
62
73
63
74
this . element
@@ -341,20 +352,6 @@ $.widget( "ui.autocomplete", {
341
352
return element ;
342
353
} ,
343
354
344
- _isMultiLine : function ( ) {
345
- // Textareas are always multi-line
346
- if ( this . element . is ( "textarea" ) ) {
347
- return true ;
348
- }
349
- // Inputs are always single-line, even if inside a contentEditable element
350
- // IE also treats inputs as contentEditable
351
- if ( this . element . is ( "input" ) ) {
352
- return false ;
353
- }
354
- // All other element types are determined by whether or not they're contentEditable
355
- return this . element . prop ( "isContentEditable" ) ;
356
- } ,
357
-
358
355
_initSource : function ( ) {
359
356
var array , url ,
360
357
that = this ;
0 commit comments