Autocomplete: Simplify _create() method

Uses logical expressions in place of conditional expressions.

Closes #1490
This commit is contained in:
Jörn Zaefferer 2015-03-13 17:16:24 +01:00
parent 581bfb55bf
commit 4212d072a1

View File

@ -76,14 +76,11 @@ $.widget( "ui.autocomplete", {
isTextarea = nodeName === "textarea", isTextarea = nodeName === "textarea",
isInput = nodeName === "input"; isInput = nodeName === "input";
this.isMultiLine = // Textareas are always multi-line
// Textareas are always multi-line // Inputs are always single-line, even if inside a contentEditable element
isTextarea ? true : // IE also treats inputs as contentEditable
// Inputs are always single-line, even if inside a contentEditable element // All other element types are determined by whether or not they're contentEditable
// IE also treats inputs as contentEditable this.isMultiLine = isTextarea || !isInput && this.element.prop( "isContentEditable" );
isInput ? false :
// All other element types are determined by whether or not they're contentEditable
this.element.prop( "isContentEditable" );
this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
this.isNewMenu = true; this.isNewMenu = true;