[jQuery] Re: cant upgrade from 1.2.3 to 1.2.6

2008-07-15 Thread Ricardo Ferreira

Hi,
I came up with this problem, and managed to get a fix to it. I am
using jquery-1.2.6.

Follows the code of the makeArray 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 
array.call != Array.prototype.call) )
ret[0] = array;
else
while( i )
ret[--i] = array[i];
}

return ret;
}

Here is the fix:
if ( ... (array.call  array.call != Array.prototype.call) )
before it was:
if ( ... array.call )

Basically what I did was only to test whether array.call was defined
and make sure it is not Array.prototype.call, so that branch will only
be true if array is a function

With this quick fix, the test case in http://dev.jquery.com/ticket/3129
obtains the expected result.

Hope this helps
Bye


[jQuery] Re: cant upgrade from 1.2.3 to 1.2.6

2008-07-15 Thread Ariel Flesler

Thanks for the proposition. But this is not a valid fix, it's a patch.

We probably need to rewrite the whole detection approach. It's not
simple as it must support many cases, and reject many as well.


Cheers
--
Ariel Flesler
http://flesler.blogspot.com

On 15 jul, 11:19, Ricardo Ferreira
[EMAIL PROTECTED] wrote:
 Hi,
 I came up with this problem, and managed to get a fix to it. I am
 using jquery-1.2.6.

 Follows the code of the makeArray 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 
 array.call != Array.prototype.call) )
                                 ret[0] = array;
                         else
                                 while( i )
                                         ret[--i] = array[i];
                 }

                 return ret;
         }

 Here is the fix:
 if ( ... (array.call  array.call != Array.prototype.call) )
 before it was:
 if ( ... array.call )

 Basically what I did was only to test whether array.call was defined
 and make sure it is not Array.prototype.call, so that branch will only
 be true if array is a function

 With this quick fix, the test case inhttp://dev.jquery.com/ticket/3129
 obtains the expected result.

 Hope this helps
 Bye


[jQuery] Re: cant upgrade from 1.2.3 to 1.2.6

2008-07-03 Thread Karl Swedberg


Hi Jeffrey,

It might be worth starting a new thread on the jquery-dev list for  
this, since it does have to do with examining the core file. Would you  
mind doing that?


thanks!

--Karl

Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Jul 3, 2008, at 12:36 PM, Jeffrey Kretz wrote:



I'm using Firefox 2 still.  Firebug is exception in all areas except  
for the
javascript debugger.  But it did allow me to set breakpoints and  
step into

(F11) the code and inspect the variables to see what was happening.

Oddly enough the grep method did not change at all between 1.2.3 and  
1.2.6.


I think we need someone who's more familiar with the core to check  
this out.


JK

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED]  
On

Behalf Of darren
Sent: Wednesday, July 02, 2008 9:57 PM
To: jQuery (English)
Subject: [jQuery] Re: cant upgrade from 1.2.3 to 1.2.6


Hi Jeff

thanks a lot for taking a look at my problem.  I edited the
jquery-1.2.6 file and added {} codeblocks to the problem area you
described, and still the same error.  Strange that the error is so
deep in the jquery library.  did you use firebug to find that bug? I'm
finding firebug to be somewhat of a pain for javascript debugging,
especially the beta with firefox 3.  Are there any other good js
debuggers out there?

If anybody else has any suggestions for me, i would really appreciate
it. thanks

On Jul 2, 6:33 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote:
As a note, your apparatusTooltips.js script has a badly-formed  
array on

lines 30-37.  This doesn't affect FF but will kill IE.

But onto the underlying problem.

The actual issue seems to be with the grep method:

// Go through the array, only saving the items
1197 // that pass the validator function
1198 for ( var i = 0, length = elems.length; i  length; i++ )
1199if ( !inv != !callback( elems[ i ], i ) )
1200   ret.push( elems[ i ] );

When show is called, it first filters by ':hidden'.

There is only 1 element in the elems array.

The loop starts off correctly, going through 1198, 1199, 1200 for the

first

iteration.

The second iteration it exist the for loop as (ilength) returns  
false.


But when exiting the loop, it still executes line 1200, adding a null

value

to the return array.

This is likely a bug in FireFox, but it would probably go away if  
code

blocks { } were expressly defined around the for loop and the if

statement.


JK

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery- 
[EMAIL PROTECTED] On


Behalf Of darren
Sent: Wednesday, July 02, 2008 4:42 PM
To: jQuery (English)
Subject: [jQuery] Re: cant upgrade from 1.2.3 to 1.2.6

right.

ok well this doesn't look like just an each() error, its happening
with click() now too.

here is the page with the

errors:http://isebeta.uvic.ca/Library/Texts/AYL/M/Scene/1.1


generate the errors by clicking on show or [+] in the Commentary
menu to the lower left of the page.
The former generates a object not defined error
the latter generates a this.style not defined

Again, this code works correctly with 1.2.3.

A suggestion on the irc channel was to first check if the thing being
passed into .each() is not undefined, but I don't really understand
this suggestion.

thanks for any help.

On Jul 2, 3:55 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote:
That part of the code is the $.each iteration.  What is the call  
stack

when

the error is thrown?



Without a better context, it's going to be really hard to see what's

going

on.



Do you have a demo page with this error?  Even if you can't post the

full
page for security reasons, if you can reproduce the error with a  
simpler

demo page that would help track it down.



JK



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery- 
[EMAIL PROTECTED] On



Behalf Of darren
Sent: Wednesday, July 02, 2008 3:00 PM
To: jQuery (English)
Subject: [jQuery] cant upgrade from 1.2.3 to 1.2.6



Hi


I'm trying to upgrade a project from jquery 1.2.3 to 1.2.6, but  
doing

so is causing a error in my script  Firebug gives the error:



object is undefined
var name, i = 0, length =

object.length;http://../script/jquery-1.2.6.js

Line 725


I'm going to try to step through my code and narrow down the  
problem,

but i'd appreciate any other suggestions.  thanks






[jQuery] Re: cant upgrade from 1.2.3 to 1.2.6

2008-07-03 Thread Jeffrey Kretz

Certainly.

Darren, could you put up two pages, one using 1.2.3 and the other using
1.2.6 so the dev team has something to look at?

I see that the url in the email below has been reverted to 1.2.3 and works
now.

JK

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Karl Swedberg
Sent: Thursday, July 03, 2008 11:24 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: cant upgrade from 1.2.3 to 1.2.6


Hi Jeffrey,

It might be worth starting a new thread on the jquery-dev list for  
this, since it does have to do with examining the core file. Would you  
mind doing that?

thanks!

--Karl

Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Jul 3, 2008, at 12:36 PM, Jeffrey Kretz wrote:


 I'm using Firefox 2 still.  Firebug is exception in all areas except  
 for the
 javascript debugger.  But it did allow me to set breakpoints and  
 step into
 (F11) the code and inspect the variables to see what was happening.

 Oddly enough the grep method did not change at all between 1.2.3 and  
 1.2.6.

 I think we need someone who's more familiar with the core to check  
 this out.

 JK

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED]  
 On
 Behalf Of darren
 Sent: Wednesday, July 02, 2008 9:57 PM
 To: jQuery (English)
 Subject: [jQuery] Re: cant upgrade from 1.2.3 to 1.2.6


 Hi Jeff

 thanks a lot for taking a look at my problem.  I edited the
 jquery-1.2.6 file and added {} codeblocks to the problem area you
 described, and still the same error.  Strange that the error is so
 deep in the jquery library.  did you use firebug to find that bug? I'm
 finding firebug to be somewhat of a pain for javascript debugging,
 especially the beta with firefox 3.  Are there any other good js
 debuggers out there?

 If anybody else has any suggestions for me, i would really appreciate
 it. thanks

 On Jul 2, 6:33 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote:
 As a note, your apparatusTooltips.js script has a badly-formed  
 array on
 lines 30-37.  This doesn't affect FF but will kill IE.

 But onto the underlying problem.

 The actual issue seems to be with the grep method:

 // Go through the array, only saving the items
 1197 // that pass the validator function
 1198 for ( var i = 0, length = elems.length; i  length; i++ )
 1199if ( !inv != !callback( elems[ i ], i ) )
 1200   ret.push( elems[ i ] );

 When show is called, it first filters by ':hidden'.

 There is only 1 element in the elems array.

 The loop starts off correctly, going through 1198, 1199, 1200 for the
 first
 iteration.

 The second iteration it exist the for loop as (ilength) returns  
 false.

 But when exiting the loop, it still executes line 1200, adding a null
 value
 to the return array.

 This is likely a bug in FireFox, but it would probably go away if  
 code
 blocks { } were expressly defined around the for loop and the if
 statement.

 JK

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery- 
 [EMAIL PROTECTED] On

 Behalf Of darren
 Sent: Wednesday, July 02, 2008 4:42 PM
 To: jQuery (English)
 Subject: [jQuery] Re: cant upgrade from 1.2.3 to 1.2.6

 right.

 ok well this doesn't look like just an each() error, its happening
 with click() now too.

 here is the page with the
 errors:http://isebeta.uvic.ca/Library/Texts/AYL/M/Scene/1.1

 generate the errors by clicking on show or [+] in the Commentary
 menu to the lower left of the page.
 The former generates a object not defined error
 the latter generates a this.style not defined

 Again, this code works correctly with 1.2.3.

 A suggestion on the irc channel was to first check if the thing being
 passed into .each() is not undefined, but I don't really understand
 this suggestion.

 thanks for any help.

 On Jul 2, 3:55 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote:
 That part of the code is the $.each iteration.  What is the call  
 stack
 when
 the error is thrown?

 Without a better context, it's going to be really hard to see what's
 going
 on.

 Do you have a demo page with this error?  Even if you can't post the
 full
 page for security reasons, if you can reproduce the error with a  
 simpler
 demo page that would help track it down.

 JK

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery- 
 [EMAIL PROTECTED] On

 Behalf Of darren
 Sent: Wednesday, July 02, 2008 3:00 PM
 To: jQuery (English)
 Subject: [jQuery] cant upgrade from 1.2.3 to 1.2.6

 Hi

 I'm trying to upgrade a project from jquery 1.2.3 to 1.2.6, but  
 doing
 so is causing a error in my script  Firebug gives the error:

 object is undefined
 var name, i = 0, length =
 object.length;http://../script/jquery-1.2.6.js
 Line 725

 I'm going to try to step through my code and narrow down the  
 problem,
 but i'd appreciate any other suggestions.  thanks





[jQuery] Re: cant upgrade from 1.2.3 to 1.2.6

2008-07-03 Thread Michael Geary

Just a note on this - it's a conflict between jQuery 1.2.6 (and NOT 1.2.3)
vs. Prototype 1.5.1 and related code.

I reduced it to a simple test case - will post something on the dev list in
a bit...



[jQuery] Re: cant upgrade from 1.2.3 to 1.2.6

2008-07-03 Thread Michael Geary

Darren, I found the actual problem. It wasn't the lack of {} in the grep
method - that was a red herring. (There's nothing wrong with the grep method
that {} would fix.)

Your page is loading script.aculo.us effects.js v1.7.1_beta3. This file
defines Array.prototype.call as a function.

That causes massive confusion inside jQuery 1.2.6, but not in 1.2.3. The
reason is the change that was made to jQuery's makeArray() function in 1.2.6
- if the code is passed an array that has a call method, it mistakenly
thinks it is not an array and does the wrong thing - line 1135 of
jquery-1.2.6.js is the pertinent code here. (The correct fix isn't
immediately obvious, but I'll file a ticket on this.)

As it happens, the current version of script.aculo.us effects.js, v1.8.1, no
longer defines Array.prototype.call.

Can you upgrade to the latest version of prototype.js and the various
script.aculo.us files you're including? That would fix the problem.

But are you actually using script.aculo.us and prototype.js in your code at
all? I noticed that there is no jQuery.noConflict() call in your code, which
means that including jQuery would break any prototype/script.aculo.us code
because of the conflict over the $() function.

I tried removing all the script.aculo.us and prototype script tags and
didn't see any errors on the page. So if you're not using them, you could
just remove these files.

-Mike



[jQuery] Re: cant upgrade from 1.2.3 to 1.2.6

2008-07-02 Thread darren

right.

ok well this doesn't look like just an each() error, its happening
with click() now too.

here is the page with the errors:
http://isebeta.uvic.ca/Library/Texts/AYL/M/Scene/1.1

generate the errors by clicking on show or [+] in the Commentary
menu to the lower left of the page.
The former generates a object not defined error
the latter generates a this.style not defined

Again, this code works correctly with 1.2.3.

A suggestion on the irc channel was to first check if the thing being
passed into .each() is not undefined, but I don't really understand
this suggestion.

thanks for any help.

On Jul 2, 3:55 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote:
 That part of the code is the $.each iteration.  What is the call stack when
 the error is thrown?

 Without a better context, it's going to be really hard to see what's going
 on.

 Do you have a demo page with this error?  Even if you can't post the full
 page for security reasons, if you can reproduce the error with a simpler
 demo page that would help track it down.

 JK

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On

 Behalf Of darren
 Sent: Wednesday, July 02, 2008 3:00 PM
 To: jQuery (English)
 Subject: [jQuery] cant upgrade from 1.2.3 to 1.2.6

 Hi

 I'm trying to upgrade a project from jquery 1.2.3 to 1.2.6, but doing
 so is causing a error in my script  Firebug gives the error:

 object is undefined
 var name, i = 0, length = 
 object.length;http://../script/jquery-1.2.6.js
 Line 725

 I'm going to try to step through my code and narrow down the problem,
 but i'd appreciate any other suggestions.  thanks


[jQuery] Re: cant upgrade from 1.2.3 to 1.2.6

2008-07-02 Thread Jeffrey Kretz

As a note, your apparatusTooltips.js script has a badly-formed array on
lines 30-37.  This doesn't affect FF but will kill IE.

But onto the underlying problem.

The actual issue seems to be with the grep method:

// Go through the array, only saving the items
1197 // that pass the validator function
1198 for ( var i = 0, length = elems.length; i  length; i++ )
1199if ( !inv != !callback( elems[ i ], i ) )
1200   ret.push( elems[ i ] );

When show is called, it first filters by ':hidden'.

There is only 1 element in the elems array.

The loop starts off correctly, going through 1198, 1199, 1200 for the first
iteration.

The second iteration it exist the for loop as (ilength) returns false.

But when exiting the loop, it still executes line 1200, adding a null value
to the return array.

This is likely a bug in FireFox, but it would probably go away if code
blocks { } were expressly defined around the for loop and the if statement.

JK

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of darren
Sent: Wednesday, July 02, 2008 4:42 PM
To: jQuery (English)
Subject: [jQuery] Re: cant upgrade from 1.2.3 to 1.2.6


right.

ok well this doesn't look like just an each() error, its happening
with click() now too.

here is the page with the errors:
http://isebeta.uvic.ca/Library/Texts/AYL/M/Scene/1.1

generate the errors by clicking on show or [+] in the Commentary
menu to the lower left of the page.
The former generates a object not defined error
the latter generates a this.style not defined

Again, this code works correctly with 1.2.3.

A suggestion on the irc channel was to first check if the thing being
passed into .each() is not undefined, but I don't really understand
this suggestion.

thanks for any help.

On Jul 2, 3:55 pm, Jeffrey Kretz [EMAIL PROTECTED] wrote:
 That part of the code is the $.each iteration.  What is the call stack
when
 the error is thrown?

 Without a better context, it's going to be really hard to see what's going
 on.

 Do you have a demo page with this error?  Even if you can't post the full
 page for security reasons, if you can reproduce the error with a simpler
 demo page that would help track it down.

 JK

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On

 Behalf Of darren
 Sent: Wednesday, July 02, 2008 3:00 PM
 To: jQuery (English)
 Subject: [jQuery] cant upgrade from 1.2.3 to 1.2.6

 Hi

 I'm trying to upgrade a project from jquery 1.2.3 to 1.2.6, but doing
 so is causing a error in my script  Firebug gives the error:

 object is undefined
 var name, i = 0, length =
object.length;http://../script/jquery-1.2.6.js
 Line 725

 I'm going to try to step through my code and narrow down the problem,
 but i'd appreciate any other suggestions.  thanks