> Its important to know that I'm almost unable to change a bit 
> of markup or other js libraries code, I'm being injected 
> along with jQuery to this site, so I'm more like a "guest" in 
> this uber-mix of js.

Could you quote the relevant text from previous message(s) in your replies?
For those of us who read the group on the mailing list, it makes it easier
to keep track of what's being discussed.

For this message, the part I had to hunt down was:

> The jquery is 1.2.6 and scriptaculous is v1.7.0

There's a known conflict between those two versions. I filed a bug report on
it and it was rejected as "wontfix". I can't get into the bug tracker or I
would look up the bug number.

The easiest fixes would be to either:

1) Upgrade Scriptaculous from 1.7.0 (which I believe was considered a beta)
to the current release version, 1.8.1 or so.

2) Downgrade jQuery to 1.2.3.

More work, but a better fix, would be to revisit the bug and come up with a
patch.

The problem is in this jQuery function:

    makeArray: function( array ) {
        var ret = [];

        if( array != null ){
            var i = array.length;
            //the window, strings and functions also have 'length'
            if( i == null || array.split || array.setInterval || array.call
)
                ret[0] = array;
            else
                while( i )
                    ret[--i] = array[i];
        }

        return ret;
    },

It's the array.call test at the end of the if statement. Scriptaculous 1.7.0
defines an Array.prototype.call method, which confuses that test. This
jQuery code expects that arrays do *not* have a call method (nor split nor
setInterval), so that addition by Scriptaculous causes this test to go
wrong.

I'm not sure what specific browser or condition that array.call test is
supposed to guard against. (Ariel, if you happen to see this message, I
believe this was your code; do you recall any of the specifics on why those
three particular methods needed to be tested?)

You could just try removing the array.call in your copy of jQuery and see
what happens:

    makeArray: function( array ) {
        var ret = [];

        if( array != null ){
            var i = array.length;
            //the window, strings and functions also have 'length'
            if( i == null || array.split || array.setInterval )
                ret[0] = array;
            else
                while( i )
                    ret[--i] = array[i];
        }

        return ret;
    },

That will fix the Scriptaculous conflict, but I don't know what other
problems it may introduce. If it does cause any problems, then maybe there
is some other method name that could be tested instead of array.call to
achieve the same end.

-Mike

Reply via email to