Closed Bug 311128 Opened 20 years ago Closed 20 years ago

Lycos banner: script end tag in document.write causes trouble in the DOM

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 2000
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 18324

People

(Reporter: fantognini, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b4) Gecko/20050909 SeaMonkey/1.0a Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b4) Gecko/20050909 SeaMonkey/1.0a This is a problem related to banners displayed by Lycos. I've seen it on two sites (space.com and wired.com) but it's probably more widespread. However it's difficult to pinpoint a reference page since the banner code does rotate every n minutes (n>10) and often displays fine. That's why I created a test page, which is a stripped down version of the lycos problem. If needed I may be able to recreate the full page. Now the technical details. The lycos banner is a js library with a single function. This function writes a bunch of document.write() each adding tags and code to the DOM. Its purpose is to select the correct way to show the banner, depending on the browser type, plugins, OS, etc. The following part of the code creates a problem: document.write ('document.write('); document.write ("'"); document.write ('</SCRIPT> \\'); document.write ('n'); document.write ("'"); document.write (');\n'); The parser gets the </SCRIPT> as the end of the script itself, stops its execution and puts everything that follows in a text node. Hence the code appears on the page and other weird things may happen. In the test page, red javascript code appears and the function foo() does not work. On wired.com multiple banners are displayed and/or js code appears too. Example: http://wired.com/news/technology/0,1282,69033,00.html (if displayed correctly, shift reload - wait a few minutes) Previous versions of Mozilla (1.7) and FF (1.0) work fine. Following FF and SM have this problem too: - Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20051004 Firefox/1.6a1 ID:2005100406 - SeaMonkey nightly 20051004 1.1a Reproducible: Always Steps to Reproduce: 1. Go to the test page 2. Or navigate wired.com (hoping the right banner shows up) 3. Actual Results: Javascript code is displayed on the page (in red for clarity): \n'); var see_this=false; if (see_this) { alert('trouble'); } } --> Function foo doesn't work. In sites that use lycos banners: banners appear twice and javascript code is displayed Expected Results: No javascript code should be displayed. Function foo should work fine. In sites that use lycos banners: banners appear once and javascript code is not displayed. See Mozilla 1.7 and FF 1.0 for correct behaviour If no DOCTYPE is specified, the test page loads fine.
You have to escape the forward slash. *** This bug has been marked as a duplicate of 18324 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
(In reply to comment #1) > You have to escape the forward slash. > > *** This bug has been marked as a duplicate of 18324 *** Sorry but I have to disagree with your assessment. Escaping the forward slash *does not solve the issue*. Javascript code still ends in DOM tree as text. (Test code was updated accordingly) IMHO this should not be considered a duplicate of 18324. Just a close relative. It's also worth noting that 18324 was actually solved in Moz 1.7 (likely earlier too) and FF 1.0.
You need to log in before you can comment on or make changes to this bug.