[Project_owners] bookmarks-tree: SeaMonkey vs Firefox.

Neil neil at parkwaycc.co.uk
Wed May 17 17:50:51 EDT 2006


Philip Chee wrote:

>On Wed, 17 May 2006 09:51:55 +0100, Neil wrote:
>  
>
>>>   var containerArc;
>>>   while (arcsIn.hasMoreElements()) {
>>>     containerArc = arcsIn.getNext();
>>
>>Nit: var containerArc = arcsIn.getNext();
>>    
>>
>I'm confused. Won't this redeclare containerArc on every loop within the while?
>  
>
Actually, in JS, you can declare the variable anywhere in the function 
you like e.g. after the return, so the only reason I suggested it was 
for the style guidelines of trying to declare the variable as near to 
where it is first assigned, but always in a parent block of all of its 
uses.

>>>       return BMDS.GetSources(containerArc, aResource, true).getNext()
>>>                  .QueryInterface(kRDFRSCIID);
>>
>>The original C++ translates to
>>return BMDS.GetSource(containerArc, aResource, true);
>>    
>>
>I actually stole this bit of code from:
><http://lxr.mozilla.org/seamonkey/source/xpfe/components/bookmarks/resources/bookmarks.js#1170>
>  
>
Couldn't you have written your code to use getParentOfContainer? Anyway, 
assuming it still works, please consider including that simplification 
it in any patches you might make to that file.


More information about the Project_owners mailing list