There is no issue with for-in loops in mac from what I've experienced.
Neither in Opera. It's a integral JS language feature and those tend to be aprox. 99%
cross-browser.
And I've built a superclass that relies HEAVILY on for-in loops.
Where there might be an issue, is if you mix an accossiativ array with a numeric one,
i.e.
a regular for loop will only loop through the numeric part, and a for-in loop will
loop through both.
So if you want to use strictly associative arrays, remove the possibility for numeric
declaration and indexing, e.g. make the array an object (object) instead.
Bart
-----Ursprungligt meddelande-----
Från: Richard Bennett <[EMAIL PROTECTED]>
Till: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Datum: den 27 juni 2001 20:20
Ämne: Re: Re[2]: [Dynapi-Dev] getAll() function
>Robert, wasn't there an issue with using "for - in" loops? something to do
>with Mac compatibility?
>I was wondering how to loop associative arrays without using it.
>
>----- Original Message -----
>From: "Robert Rainwater" <[EMAIL PROTECTED]>
>To: "Jordi Ministral" <[EMAIL PROTECTED]>
>Sent: 27 June, 2001 17:19
>Subject: Re[2]: [Dynapi-Dev] getAll() function
>
>
>>
>> The for loop has to be a for (i in j) type loop because it is an
>> associative array and the length will return null in some browsers. I
>> believe this was changed a while back and quickly reverted back to the
>> correct way.
>>
>> --
>> Robert Rainwater
>>
>>
>> On 6/27/2001, 10:26:58 AM EST, Jordi wrote about "[Dynapi-Dev] getAll()
>function":
>>
>> > Hey, just looked into the latest code and it reads:
>>
>> > for(var j in temp) ret[j] = temp[j];
>>
>> > That is correct. What version are we talking about ? ( Why do I always
>> > end up asking this same question ? )
>>
>>
>> > Bogdan Pietroiu wrote:
>>
>> >>
>> >>
>> >> wrigth now, the function looks like this
>> >>
>> >> (in dynapi.js)
>> >>
>> >> DynObject.prototype.getAll = function() {
>> >> var ret = [];
>> >> var temp;
>> >> var l = this.children.length;
>> >> for(var i=0;i<l;i++) {
>> >> ret[this.children[i].id] = this.children[i];
>> >> temp = this.children[i].getAll();
>> >> for(var j=0;j<temp.length;j++) ret[j] = temp[j];
>> >> }
>> >> return ret
>> >> };
>> >>
>> >> do you notice the for statement after the recurent call to get all ???
>> >>
>> >> it inserts layers into ret array, but not indexed by there name ....
>> >> this is a serious bug , boys ....
>> >>
>> >> i guess the function should look like this ....
>> >> DynObject.prototype.getAll = function() {
>> >> var ret = [];
>> >> var temp;
>> >> var l = this.children.length;
>> >> for(var i=0;i<l;i++) {
>> >> ret[this.children[i].id] = this.children[i];
>> >> temp = this.children[i].getAll();
>> >> for(var j=0;j<temp.length;j++) ret[temp[j].id] =
>> >> temp[j];
>> >> }
>> >> return ret
>> >> };correct me if Im wrong ...
>> >>
>> >>
>> >> Bogdan Pietroiu
>> >> IT Specialist
>> >> MIS Department
>> >> Flamingo Computers SA
>> >> tel: +40-1-236.2002
>> >> fax: +40-1-236.2004
>> >> e-mail: [EMAIL PROTECTED]
>> >> web: www.flamingo.ro
>>
>>
>> > _______________________________________________
>> > Dynapi-Dev mailing list
>> > [EMAIL PROTECTED]
>> > http://lists.sourceforge.net/lists/listinfo/dynapi-dev
>>
>>
>> _______________________________________________
>> Dynapi-Dev mailing list
>> [EMAIL PROTECTED]
>> http://lists.sourceforge.net/lists/listinfo/dynapi-dev
>>
>
>
>_______________________________________________
>Dynapi-Dev mailing list
>[EMAIL PROTECTED]
>http://lists.sourceforge.net/lists/listinfo/dynapi-dev
>
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-dev