Ignore:
Timestamp:
Feb 18, 2013, 10:18:40 PM (11 years ago)
Author:
rvelices
Message:

upgraded jquery ui from 1.9.0 to 1.10.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/themes/default/js/ui/jquery.ui.autocomplete.js

    r18630 r20824  
    11/*!
    2  * jQuery UI Autocomplete 1.9.0
     2 * jQuery UI Autocomplete 1.10.1
    33 * http://jqueryui.com
    44 *
    5  * Copyright 2012 jQuery Foundation and other contributors
     5 * Copyright 2013 jQuery Foundation and other contributors
    66 * Released under the MIT license.
    77 * http://jquery.org/license
     
    2121
    2222$.widget( "ui.autocomplete", {
    23         version: "1.9.0",
     23        version: "1.10.1",
    2424        defaultElement: "<input>",
    2525        options: {
    26                 appendTo: "body",
     26                appendTo: null,
    2727                autoFocus: false,
    2828                delay: 300,
     
    5555                // events when we know the keydown event was used to modify the
    5656                // 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" ];
    6172                this.isNewMenu = true;
    6273
     
    6576                        .attr( "autocomplete", "off" );
    6677
    67                 this._on({
     78                this._on( this.element, {
    6879                        keydown: function( event ) {
     80                                /*jshint maxcomplexity:15*/
    6981                                if ( this.element.prop( "readOnly" ) ) {
    7082                                        suppressKeyPress = true;
     
    181193                this._initSource();
    182194                this.menu = $( "<ul>" )
    183                         .addClass( "ui-autocomplete" )
    184                         .appendTo( this.document.find( this.options.appendTo || "body" )[ 0 ] )
     195                        .addClass( "ui-autocomplete ui-front" )
     196                        .appendTo( this._appendTo() )
    185197                        .menu({
    186198                                // custom key handling for now
     
    189201                                role: null
    190202                        })
    191                         .zIndex( this.element.zIndex() + 1 )
    192203                        .hide()
    193                         .data( "menu" );
     204                        .data( "ui-menu" );
     205
    194206                this._on( this.menu.element, {
    195207                        mousedown: function( event ) {
     
    237249                                }
    238250
    239                                 // back compat for _renderItem using item.autocomplete, via #7810
    240                                 // TODO remove the fallback, see #8156
    241                                 var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" );
     251                                var item = ui.item.data( "ui-autocomplete-item" );
    242252                                if ( false !== this._trigger( "focus", event, { item: item } ) ) {
    243253                                        // use value to match what will end up in the input, if it was a key event
     
    255265                        },
    256266                        menuselect: function( event, ui ) {
    257                                 // back compat for _renderItem using item.autocomplete, via #7810
    258                                 // TODO remove the fallback, see #8156
    259                                 var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ),
     267                                var item = ui.item.data( "ui-autocomplete-item" ),
    260268                                        previous = this.previous;
    261269
     
    292300                        .insertAfter( this.element );
    293301
    294                 if ( $.fn.bgiframe ) {
    295                          this.menu.element.bgiframe();
    296                 }
    297 
    298302                // turning off autocomplete prevents the browser from remembering the
    299303                // value when navigating through history, so we re-enable autocomplete
     
    321325                }
    322326                if ( key === "appendTo" ) {
    323                         this.menu.element.appendTo( this.document.find( value || "body" )[0] );
     327                        this.menu.element.appendTo( this._appendTo() );
    324328                }
    325329                if ( key === "disabled" && value && this.xhr ) {
     
    328332        },
    329333
    330         _isMultiLine: function() {
    331                 // Textareas are always multi-line
    332                 if ( this.element.is( "textarea" ) ) {
    333                         return true;
    334                 }
    335                 // Inputs are always single-line, even if inside a contentEditable element
    336                 // IE also treats inputs as contentEditable
    337                 if ( this.element.is( "input" ) ) {
    338                         return false;
    339                 }
    340                 // All other element types are determined by whether or not they're contentEditable
    341                 return this.element.prop( "isContentEditable" );
     334        _appendTo: function() {
     335                var element = this.options.appendTo;
     336
     337                if ( element ) {
     338                        element = element.jquery || element.nodeType ?
     339                                $( element ) :
     340                                this.document.find( element ).eq( 0 );
     341                }
     342
     343                if ( !element ) {
     344                        element = this.element.closest( ".ui-front" );
     345                }
     346
     347                if ( !element.length ) {
     348                        element = this.document[0].body;
     349                }
     350
     351                return element;
    342352        },
    343353
     
    360370                                        data: request,
    361371                                        dataType: "json",
    362                                         success: function( data, status ) {
     372                                        success: function( data ) {
    363373                                                response( data );
    364374                                        },
     
    479489
    480490        _suggest: function( items ) {
    481                 var ul = this.menu.element
    482                         .empty()
    483                         .zIndex( this.element.zIndex() + 1 );
     491                var ul = this.menu.element.empty();
    484492                this._renderMenu( ul, items );
    485493                this.menu.refresh();
     
    542550        },
    543551
    544         _value: function( value ) {
     552        _value: function() {
    545553                return this.valueMethod.apply( this.element, arguments );
    546554        },
     
    598606});
    599607
    600 
    601608}( jQuery ));
Note: See TracChangeset for help on using the changeset viewer.