diff options
author | Felix Nagel <info@felixnagel.com> | 2013-02-09 03:29:10 +0100 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2013-02-09 03:29:10 +0100 |
commit | a7b4f29cea06607264c2ba98cd93f4e039cce5bd (patch) | |
tree | 1ac9e210ce8fd16a85cb1d3283983475b27437ed /ui/jquery.ui.autocomplete.js | |
parent | b81bb0b983687b1efc09577bf128b8a5b7aa5d7b (diff) | |
parent | ab408c9b82430e7a65a9269441cc0c0e2af95770 (diff) | |
download | jquery-ui-a7b4f29cea06607264c2ba98cd93f4e039cce5bd.tar.gz jquery-ui-a7b4f29cea06607264c2ba98cd93f4e039cce5bd.zip |
Merge branch 'master' into selectmenu
Diffstat (limited to 'ui/jquery.ui.autocomplete.js')
-rw-r--r-- | ui/jquery.ui.autocomplete.js | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index af1acb02b..1b0f2138f 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -54,10 +54,21 @@ $.widget( "ui.autocomplete", { // so we use the suppressKeyPressRepeat flag to avoid handling keypress // events when we know the keydown event was used to modify the // search term. #7799 - var suppressKeyPress, suppressKeyPressRepeat, suppressInput; - - this.isMultiLine = this._isMultiLine(); - this.valueMethod = this.element[ this.element.is( "input,textarea" ) ? "val" : "text" ]; + var suppressKeyPress, suppressKeyPressRepeat, suppressInput, + nodeName = this.element[0].nodeName.toLowerCase(), + isTextarea = nodeName === "textarea", + isInput = nodeName === "input"; + + this.isMultiLine = + // Textareas are always multi-line + isTextarea ? true : + // Inputs are always single-line, even if inside a contentEditable element + // IE also treats inputs as contentEditable + 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.isNewMenu = true; this.element @@ -181,7 +192,7 @@ $.widget( "ui.autocomplete", { this._initSource(); this.menu = $( "<ul>" ) - .addClass( "ui-autocomplete" ) + .addClass( "ui-autocomplete ui-front" ) .appendTo( this._appendTo() ) .menu({ // custom key handling for now @@ -189,7 +200,6 @@ $.widget( "ui.autocomplete", { // disable ARIA support, the live region takes care of that role: null }) - .zIndex( this.element.zIndex() + 1 ) .hide() .data( "ui-menu" ); @@ -341,20 +351,6 @@ $.widget( "ui.autocomplete", { return element; }, - _isMultiLine: function() { - // Textareas are always multi-line - if ( this.element.is( "textarea" ) ) { - return true; - } - // Inputs are always single-line, even if inside a contentEditable element - // IE also treats inputs as contentEditable - if ( this.element.is( "input" ) ) { - return false; - } - // All other element types are determined by whether or not they're contentEditable - return this.element.prop( "isContentEditable" ); - }, - _initSource: function() { var array, url, that = this; @@ -492,9 +488,7 @@ $.widget( "ui.autocomplete", { }, _suggest: function( items ) { - var ul = this.menu.element - .empty() - .zIndex( this.element.zIndex() + 1 ); + var ul = this.menu.element.empty(); this._renderMenu( ul, items ); this.menu.refresh(); |