innerHTML returns escaped versions of the <>& characters when they appear within <script> blocks. (Steve mentioned this problem on http://www.bookmarklets.com/tools/new.html yesterday.)
Created attachment 19463 [details] testcase
Confirmed that script.innerHTML escapes < and > on 2000-12-04-04/Win2k. Note however that < and > are is not escaped in script blocks if retrieved via document.body.innerHTML. Attaching test case.
Created attachment 20189 [details] illustrate <,> escaped in script.innerHTML but not in document.body.innerHTML
I have created a javascript patch that fixes this problem. I wrote the patch for the Range object (see bug 30838) and had to fix the innerHTML bug on orphaned nodes (see bug 70613). When fixing that bug I seem to have also fixed this bug. You can download a copy of the JavaScript patch at http://pbwizard.com/Moz%20Patches/RangePatch.zip. This download also contains test cases that I used for testing my code. Since this patch is implemented in JavaScript it will have to be converted to C++ for proper implementation. If you have any questions or comments please e- mail me at PBWiz@PBWizard.com. Jeff Yates.
I'll see what I can do. Not guaranteeing anything.
Extending summary to cover bugs which I will be resolving as duplicates of this bug. Here is another test case: http://bugzilla.mozilla.org/showattachment.cgi?attach_id=30413
*** Bug 75543 has been marked as a duplicate of this bug. ***
*** Bug 75671 has been marked as a duplicate of this bug. ***
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 (you can query for this string to delete spam or retrieve the list of bugs I've moved)
Need more info here. Is this affecting real world web sites? Is it "bad"? Tentatively marking P4, please speak up if you disagree. Sending to DOM Mozilla Extensions (innerHTML issue) Removing dom2 keyword... innerHTML is not part of DOM2.
I experience also a problem with assigning innerHTML. During assigning of innerHTML of a just created (DOM) div, it converts & to & (and do not touch < or >).
Vit: Do you have a testcase?
Sorry, false alarm. It was my problem.
Mass-reassigning bugs to dom_bugs@netscape.com
Testcase 1 WFM build 2003052704, Windows 2000.
WFM Gecko/20031009 Firebird/0.7+ (aebrahim)
The first testcase works, and so do the first parts of the 2nd testcase, but the part where it says "Fire loaded function" doesn't appear to work still. Is this expected? Can you guys check the 2nd testcase and see if your results agree?
Brian: that's bug 147581 (invalid).
Jesse, the second part of the test case is somewhat different from what is claimed in bug 147581. In bug 147581, it is claimed that IE doesn't execute the scripts and that is a good enough reason for us not to do so. In this case, an inline script using DEFER is added via innerHTML and IE6 *will* execute the functions. IE will also load an external script if it is DEFERred. I will attach a test case. So, bug 147581 should really be about supporting DEFER on scripts. jst?
Created attachment 133245 [details] external script for test case 2
Created attachment 133246 [details] test case 2
test case 2 worked when running it as an example from the local disk, but doesn't work running the external script from bugzilla. It appears the & in the attachment url is escaped. Save test case 2 and it's script, edit to point to the external file and it will work in IE.