Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#6199 closed bug (worksforme)

Unable to create multiple autocomplete with Google Chrome

Reported by: manudwarf Owned by:
Priority: major Milestone:
Component: ui.autocomplete Version: 1.8.5
Keywords: chrome google autocomplete ignore two Cc:
Blocked by: Blocking:

Description

Hi !

I created two search fields, each of them including autocomplete. Everything works fine on Firefox & IE, but there is a bug on Google Chrome : I cannot run two autocomplete at a time. The first one seems to be ignored and returns and error on the following code :

$.each( [ "Width", "Height" ], function( i, name ) {
    var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
        type = name.toLowerCase(),
        orig = {
            innerWidth: $.fn.innerWidth,
            innerHeight: $.fn.innerHeight,
            outerWidth: $.fn.outerWidth,
            outerHeight: $.fn.outerHeight
        };

    function reduce( elem, size, border, margin ) {
        $.each( side, function() {
            size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
            if ( border ) {
                size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
            }
            if ( margin ) {
                size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
            }
        });
        return size;
    }

    $.fn[ "inner" + name ] = function( size ) {
        if ( size === undefined ) {
            return orig[ "inner" + name ].call( this );
        }

        return this.each(function() {
            $.style( this, type, reduce( this, size ) + "px" );
        });
    };

    $.fn[ "outer" + name] = function( size, margin ) {
        if ( typeof size !== "number" ) {
            return orig[ "outer" + name ].call( this, size );
        }

        return this.each(function() {
            $.style( this, type, reduce( this, size, true, margin ) + "px" );
        });
    };
});

On this line (at the end of the quote) :

$.style( this, type, reduce( this, size, true, margin ) + "px" );

Chrome says :

Uncaught TypeError: Object function (E,F){return new o.fn.init(E,F)} has no method 'style'

PS: I'm not a js expert.

Change History (2)

comment:1 Changed 12 years ago by Scott González

Resolution: worksforme
Status: newclosed

Works for me. Please use the forums if you continue having problems.

comment:2 Changed 10 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.