Skip to main content

Search and Top Navigation

#6199 closed bug (worksforme)

Opened October 19, 2010 08:27AM UTC

Closed October 19, 2010 01:45PM UTC

Last modified October 11, 2012 09:15PM UTC

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.

Attachments (0)
Change History (2)

Changed October 19, 2010 01:45PM UTC by scottgonzalez comment:1

resolution: → worksforme
status: newclosed

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

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:2

milestone: TBD

Milestone TBD deleted