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

Bug #8684 Problem with generated JavaScript.
Submitted: 2006-09-13 11:35 UTC
From: ipa at assis dot lt Assigned: farell
Status: Closed Package: HTML_Progress2 (version 2.1.0)
PHP Version: Irrelevant OS: All
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


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 : 26 + 43 = ?

 
 [2006-09-13 11:35 UTC] ipa at assis dot lt (Ilja Polivanovas)
Description: ------------ In generated Javascript functions variable `name` is not in local scope. Therefore beeing global, that functions modify window.name property. In that case it can brake HTML links from working properly. Test script: --------------- HTML_Progress2 generates: function showCell(pCell, pIdent, pVisibility) { name = '%progressCell%' + pCell + 'A' + pIdent; document.getElementById(name).style.visibility = pVisibility; } function hideProgress(pIdent, pCellCount) { name = 'tfrm' + pIdent; document.getElementById(name).style.visibility = 'hidden'; for (i = 0; i < pCellCount; i++) { showCell(i, pIdent, 'hidden'); } } function setLabelText(pIdent, pName, pText) { name = 'plbl' + pName + pIdent; document.getElementById(name).firstChild.nodeValue = pText; } function setElementStyle(pPrefix, pName, pIdent, pStyles) { name = pPrefix + pName + pIdent; styles = pStyles.split(';'); styles.pop(); for (i = 0; i < styles.length; i++) { s = styles[i].split(':'); c = 'document.getElementById(name).style.' + s[0] + '="' + s[1] + '"'; eval(c); } } function setRotaryCross(pIdent, pName) { name = 'plbl' + pName + pIdent; cross = document.getElementById(name).firstChild.nodeValue; switch(cross) { case "--": cross = "\\\\"; break; case "\\\\": cross = "|"; break; case "|": cross = "/"; break; default: cross = "--"; break; } document.getElementById(name).firstChild.nodeValue = cross; } Expected result: ---------------- The same scripts, but insted of "name =..." there should be "var name = ..."

Comments

 [2006-09-13 16:15 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-09-14 12:06 UTC] ipa at assis dot lt
It's to long to produce real example with HTML_Progress2 but i make a short one to ilustrate the problem which appears in the package using global name property: index.html ==================== <html> <body> <iframe name="frameWithProgress" src=""></iframe> <p><a href="http://www.google.com" target="frameWithProgress">Step 1. Shows that target works</a></p> <p><a href="progress.html" target="frameWithProgress">Step 2. Loading a page with progress</a></p> <p><a href="http://www.google.com" target="frameWithProgress">Step 3. Same as Step 1, A link must go to that iframe, but doesn't in IE and Opera. FF seems to works</a></p> </body> </html> progress.html ==================== <html> <body> <script> // Function contents doesn't matter, just setting the global name property function anyFunction() { name = 'anything'; } // we need only to run it anyFunction(); </script> I'm an example to brake the target (by changing window.name property) </body> </html>
 [2006-12-20 09:58 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!