Hi Jörn,

The problem in fact is Ext Related, yet can be reproduced without Ext:
any library that expands the Array prototype with a function can be
the wrongdoer.

Create a new blank document (nothing needs to be in it), open up
firebug and paste in the code below:

Array.prototype.letsBreakStuff = function(){return this};
correct = [
    "baa",
    "bah!",
    "bar",
    "bar!",
    "beblog",
    "bezar",
    "blog",
    "blub",
    "blub!",
    "boo",
    "bramus"
];

As you can see this in fact does work correct.

However, I'm a great JSON-addict, and my autocompletion data - just as
any other call - is returned in the Object Literal Notation (and then
run through a custom parse function to get an autocomplete compatible
array).

Now, open up Firebug again and paste in this code:

Array.prototype.letsBreakStuff = function(){return this};
wrong = { "data":[
        "baa",
        "bah!",
        "bar",
        "bar!",
        "beblog",
        "bezar",
        "blog",
        "blub",
        "blub!",
        "boo",
        "bramus"
    ]
}

Check wrong.data, you'll see that the last item is the letsBreakStuff
function.

To make it all complete: the reason I named Ext is that I got the
remove function as last item on wrong.data ... which is added by Ext:
Ext.applyIf(Array.prototype,{indexOf:function(C){for(var
B=0,A=this.length;B<A;B++){if(this[B]==C){return B}}return
-1},remove:function(B){var A=this.indexOf(B);if(A!=-1){this.splice(A,
1)}return this}});

Hope you now see why exactly I suggested that little patch ;)

Regards,
Bramus!

On Jun 24, 3:57 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
wrote:
> I don't quite the how the issue is related to ExtJS. It sounds like
> you pass functions instead of strings to the autocomplete plugin,
> which is the actual issue here. Could you upload a testpage and post
> the URL here?
>
> Jörn
>
> On Tue, Jun 24, 2008 at 1:03 PM, Bramus! <[EMAIL PROTECTED]> wrote:
>
> > Filed a ticket on dev.jquery including a .diff 
> > file:http://dev.jquery.com/ticket/3080
> > ;-)
>
> > Regards,
> > B!
>
> > PS: [autocomplete] prefix seems to be cut off subject?
>
> > On Jun 24, 11:15 am, "Bramus!" <[EMAIL PROTECTED]> wrote:
> >> Hi Jörn et all here at the list,
>
> >> I'm using the autocomplete plugin in a project I'm working on and I
> >> must say: it works great!. However: one part of the project uses ExtJS
> >> (their tree component is great) and that's where things go wrong.
> >> Problem is that somewhere in ExtJS they extend Object with a remove()
> >> function, breaking jQuery.autocomplete.
>
> >> After a little quest I found that - quite obviously - autocomplete
> >> breaks on string manipulations (Function.toLowerCase() doesn't really
> >> exist ;)) and has a minor issue when displaying the items whenever
> >> some library has extended Object.
>
> >> Here below are the 2 minor changes I implemented in order to make
> >> things work "just fine" again. Could you tuck 'm into the release as I
> >> can't commit any changes to the trunk.
>
> >> Change #1: Display issue: $.Autocompleter.Select, function fillList():
> >> replace:
> >> if (!data[i])
> >> with:
> >> if (!data[i] || (data[i].value.constructor === Function))
>
> >> Change #2: Selection issue: $.Autocompleter.Cache, function
> >> matchSubset()
> >> at line#1 of this function (directly after the opening { ) add:
> >> if (s.constructor === Function) return false;
>
> >> Regards,
> >> Bramus!

Reply via email to