[opencms-dev] second version of tree.js (Firefox 3.5 script errors in Explorer view)
Andreas Zahner
a.zahner at alkacon.com
Thu Jul 9 15:52:50 CEST 2009
Hi Christian,
thank you for your efforts regarding the explorer tree in FF 3.5. I
tested your second version and checked it into CVS Head.
If there are any more issues, it would be nice if you could add them to
the checked in version, because I moved some variable declarations to
the beginning of the file (see the attached file).
Thank you again!
Regards,
Andreas.
-------------------
Andreas Zahner
Alkacon Software GmbH - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org
Christian Steinert schrieb:
> Sorry - my first version of the tree code introduced a bug, due to a
> missing null/undefined check.
>
> This version fixes that.
>
> If there should still be issues, then please let me know
> Christian
>
>> Dear all, dear Achim
>>
>> I have fixed various issues with the javascript code that displays the
>> Explorer tree, to make it work properly with Firefox 3.5.
>>
>> The updated file is attached. It should work at least with Opencms
>> 7.0.x and 7.5.x.
>> You have to upload it to the folder
>> /system/workplace/resources/commons/ of your opencms installation and
>> then publish it.
>>
>> As noted before, I won't have time to look into other Firefox 3.5
>> issues. If further bugs come up for tree.js, I would be willing to
>> take another look but if there are still problems in other areas, then
>> it would be great, if others could also help to fix them. Alkacon is
>> doing a lot, but they can't be expected to always do everything by
>> themselves.
>>
>> ____________
>>
>> Things that were changed (none of these changes should negatively
>> affect other browsers):
>>
>> - The tree does not seem to hang/freeze anymore after a rewrite of
>> function getNodeIdByName. Before, the logic had been a bit complicated
>> and the conditions for terminating this functions, were in my opinion
>> a bit dubious before when not finding a tree node.
>>
>> - All access to tree nodes (previously done directly through direct
>> array access in the form tree.nodes[ nodeId ]) is now handled by a new
>> function getNodeById.
>> It seems that at least part of the tree problems in Firefox was, that
>> tree nodes are usually using numbers as IDs but sometimes, strings
>> that contain numbers are used for accessing them. Maybe, Firefox 3.5
>> is a little stricter in such situations, as soon as the JIT is
>> enabled, since the JIT will try to impose type information onto
>> javascript variables. The new getNodeById function will sanitize input
>> and find tree nodes anyway, even if the node index was passed in as a
>> String and not a number. All future read access of tree nodes should
>> also be done through this function.
>>
>> - lots of cleanup:
>> * sanitized all checks for null/undefined - if(foo != null) was
>> changed to if(foo); if(foo==null) was changed to if(!foo), both of
>> which are much safer
>> * changed string concatenation so that "+" is at the end of the
>> previous line, which is not as nice to read, but a lot safer
>> (javascript will automatically insert semicolons in various
>> situations, and therefore, it matters a lot, where line breaks are)
>> * where possible, changed comparisons to use === instead of == which
>> is faster and safer. Note that this is not alway possible, because
>> node ids can sometimes be numbers and sometimes be strings
>> * added various missing variable declarations where they had been
>> forgotten (undeclared variables are implicitly global in Javascript,
>> which can lead to nasty bugs)
>> * re-ordered functions so that they are always defined before their
>> first caller, as advised by jslint.
>> * fixed all remaining jslint errors
>>
>> Comments are welcome.
>>
>> Kind Regards
>> Christian
>>
>
>
> ------------------------------------------------------------------------
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tree.js
Type: application/javascript
Size: 22764 bytes
Desc: not available
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20090709/cde0818a/attachment.js>
More information about the opencms-dev
mailing list