Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.2

Bug #14340 treemenus break if prototype.js is loaded in safari
Submitted: 2008-07-12 23:04 UTC
From: toastbrot Assigned:
Status: Feedback Package: HTML_TreeMenu (version 1.2.1)
PHP Version: 5.2.0 OS: debian etch
Roadmaps: (Not assigned)    
Subscription  


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 45 + 6 = ?

 
 [2008-07-12 23:04 UTC] toastbrot (Ivo Schindler)
Description: ------------ i see a very strange behavior in safari when using prototype.js and HTML_TreeMenu together. to reproduce get prototype.js (http://www.prototypejs.org/assets/ 2008/1/25/prototype-1.6.0.2.js) and treemenu.js (http://cvs.php.net/ viewvc.cgi/pear/HTML_TreeMenu/TreeMenu.js?revision=1.22). and test the following html with safari on mac or windows (http:// www.apple.com/safari/download/) thank you and greetings.ivo Test script: --------------- <html> <head> <script src="TreeMenu.js" type="text/javascript"></script> <script type="text/javascript" src="prototype.js"></script> </head> <body> <script type="text/javascript"> //<![CDATA[ objTreeMenu_1 = new TreeMenu("TMimages", "objTreeMenu_1","_self", "", true, false); newNode = objTreeMenu_1.addItem(new TreeNode('a', null, '',true, true, '', '', null)); newNode_1 = newNode.addItem(new TreeNode('b', null, '', true,true, '', '', null)); newNode_1_1 = newNode_1.addItem(new TreeNode('c', null, '',false, true, '', '', null)); objTreeMenu_1.drawMenu(); objTreeMenu_1.writeOutput(); objTreeMenu_1.resetBranches(); // ]]> </script> </body> </html> Expected result: ---------------- normal menu Actual result: -------------- menu with js-code readable. when prototype.js is not loaded all works well. when its loaded the menu breaks. somehow the js-code from the treemenu is not executed, but shown. this happens only in safari!

Comments

 [2008-07-14 13:26 UTC] doconnor (Daniel O'Connor)
I don't suppose you've got a live example of this floating around, Ivo?
 [2008-07-14 13:50 UTC] toastbrot (Ivo Schindler)
check these out: broken (only with safari) : http://videopong.videokultur.ch/bla.html working: http://videopong.videokultur.ch/bla2.html
 [2008-08-23 16:26 UTC] kguest (Ken Guest)
the videopong urls provided are "not found" - I get a 404 when trying to retrieve them.
 [2008-08-23 16:35 UTC] toastbrot (Ivo Schindler)
yes files were removed as i changed to an other js-tree-library. but you can setup your own test by following my short description... thank you anyway.
 [2008-12-22 05:27 UTC] dsainty (David Sainty)
The problem is (in $Id: TreeMenu.js,v 1.22 2006/12/14 12:07:34 cweiske Exp $) Line 206: for (j in nodes[i].events) With prototype.js loaded, the Array class suddenly has a whole lot of extra properties, which the above loop iterates over. This generates enormous output that the poor browser needs to parse. It looks like only Safari screws it up totally :) Firefox gets even slower than usual trying to deal with all the additional crap though - it's quite noticeable! But TreeMenu.js is abusing the Array object anyway. Array is designed for numerically indexed arrays, not associative arrays. So one simple solution is to change: Line 558: this.events = new Array(); to: Line 558: this.events = new Object(); I'd guess that several more of those new Array() calls should have the same treatment, otherwise any use of for(x in y) will get into trouble. But this one fix is enough to get things working in Safari again. I haven't yet noticed any other ill effects from prototype.js.
 [2012-01-24 18:45 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Feedback
Thank you for taking the time to report a problem with the package. This problem may have been already fixed by a previous change that is in the SVN of the package. Please checking out the SVN repository of this package and upgrade svn checkout svn.php.net/repository/pear/packages/HTML_TreeMenu/trunk pear upgrade package2.xml or pear upgrade package.xml If you are able to reproduce the bug with the latest SVN, please change the status back to "Open". Again, thank you for your continued support of PEAR.