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

Reply via email to