Closed Bug 215904 Opened 22 years ago Closed 20 years ago

Mozilla don't read javascript in XHTML 1.1 when we put this into <body>

Categories

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

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 68193

People

(Reporter: menkara, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ca; rv:1.4) Gecko/20030624 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; ca; rv:1.4) Gecko/20030624 When we put javascript into the <body> of an XHTML 1.1 with good declarations as: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" /> ... the javascript that was insert into the body don't work. Like this: <script type="text/javascript" src="cosa.js"></script> or <script type="text/javascript">document.write(aixo)</script> aixo is a text saved into a .js file declared in the head of the XHTML page. This examples don't work in Mozilla. If we put // <![CDATA[ // ]]> don't work too. Newer versions solve this at this moment (like 1.5?). B. Reproducible: Always Steps to Reproduce: 1. I write the code in XHTML with javascript in the body. 2. I run the XHTML page and the explicit <script></script> parts don't work. 3. The javascript only work if the file is saved .html, and we don't put any xhtml declaration into head, like xmlns, <?xml...?> and <meta http-equiv... content="application/xhtml+xml:..." />. With the correct doctype works. Actual Results: The explicit javascript parts (<script></script>) don't work in the body of the XHTML pages wellformed and with the good declarations. Expected Results: The javascript explicit parts works into XHTML pages wellformed and with the good declarations (especified in a previous textbox) the code of the XHTML web page: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Language" content="ca" /> <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" /> <meta name="Author" content="Desastre &amp; Co." /> <meta name="Copyight" content="&copy; Desastre &amp; Co." /> <meta name="KeyWords" content="Calaix deSastre, calaix, sastre, desastre, calendari, republicà, mesos, veremari, bromari, rufolari, nivós, pluviós, ventós, germinal, floral, pradal, segador, termidor, fructidor, català, llengua, catalana, dècada, literatura, texts, treballs, estudis, recerca, companyia, digueu" /> <meta name="Description" content="Calaix deSastre... una mica de tot, una mica de res." /> <title>Calaix deSastre...</title> <link rel="Shorcut Icon" href="calaix.ico" /> <link rel="StyleSheet" type="text/css" media="screen" href="estils.css" /> <script type="text/javascript"> window.status="Calaix deSastre..." </script> <script type="text/javascript"> function treuretext(){ window.status="Calaix deSastre..." } </script> <script type="text/javascript" src="codis.js"></script> </head> <body style="background-color : #FFFFFF;"> <div style="position:absolute;top:20px;left:2px"> <img src="preg_existencial.png" alt="El dubte existencial de la pàgina!" /> </div> <div class="col-dret"> <img src="recicla.png" alt="Aquesta pàgina és reciclable! Qui ho diria..." /> <br/> <a href="javascript:web_ind()" onmouseover="window.status='Vés al document de webs independents (en occità)'; return true" onmouseout="treuretext()"><img src="arton62.gif" alt="Jo ja m'hi adheresc. I vós?" /></a> <br/> <img src="obres.png" alt="Pàgina ETERNAMENT en obres!" /> </div> <div class="data"> Segons el petit codi programat i inserit a ma pàgina, avui és... <br/><script type="text/javascript" src="data_republicana.js"></script> </div> <div class="base"> <div class="menu"> <img src="logo_ben_tip.png" alt="Calaix deSastre..." /> <br/> <a href="javascript:acull()" onmouseover="window.status='Vés a l´Acull'; return true" onmouseout="treuretext()"><img src="acull.png" alt="Vés a l'Acull" /></a> <br/> <a href="javascript:papers()" onmouseover="window.status='Vés als Papers'; return true" onmouseout="treuretext()"><img src="papers.png" alt="Vés als Papers" /></a> <br/> <a href="javascript:digueu()" onmouseover="window.status='Aneu-hi per dir la vostra!'; return true" onmouseout="treuretext()"><img src="digueu.png" alt="Aneu-hi per dir la vostra!" /></a> <br/> <a href="javascript:coses()" onmouseover="window.status='Vés a les Coses de Casa'; return true" onmouseout="treuretext()"><img src="coses_d_casa.png" alt="Vés a les Coses de Casa" /></a> </div> <div id="acull_fin" class="finestra-pral"> <div class="titol">Benvinguts al Calaix deSastre!</div> <div style="text-indent:25px;"> text </div> </div> </div> <div id="papers_fin" class="finestra"> <div class="titol2">Paper amb papeeeer, fa més papeeeer...</div> <div style="text-indent:25px"> text </div> <br/> <div style="text-align:center"><img src="entra.png" alt="E N T R A !" /></div> <button class="boto2" name="entra" value="E N T R A" onclick="entra_papers()" type="button"> E N T R A </button> <br/> <br/> </div> <div id="prog_fin" class="finestra"> <div class="titol3">Digueuuuu...?</div> <div style="text-indent:25px"> "Digueu...? No, senyora, NO! Ací no és la carnisseria Sensòs. No hi ha de què, senyora." </div> <div style="text-indent:25px"> text </div> <br/> <br/> <div class="llegeix" id="botonet1"> <img src="llegeix.png" alt="Llegeix els texts!" /> </div> <div class="afegeix" id="botonet2"> <img src="afegeix.png" alt="Afegeix un text!" /> </div> <div style="text-align:center;"> <button class="boto3" name="entra" value="L L E G E I X E L S T E X T S" onclick="entra_digueu()" onmouseover="mostra_llegeix()" onmouseout="treu_llegeix()" type="button"> L L E G E I X&nbsp;&nbsp;&nbsp;E L S&nbsp;&nbsp;&nbsp;T E X T S </button> <br/> <br/> <br/> <button class="boto3" name="entra" value="A F E G E I X U N T E X T" onclick="envia_text()" onmouseover="mostra_afegeix()" onmouseout="treu_afegeix()" type="button"> A F E G E I X&nbsp;&nbsp;&nbsp;U N&nbsp;&nbsp;&nbsp;T E X T </button> <br/> <br/> </div> </div> <div id="enllacos_fin" class="finestra"> <div class="titol4">La Intendència</div> <div style="text-indent:25px"> text </div> <div style="text-align:center"><br/><img src="tafaner.png" alt="T A F A N E J A !" /></div> <button class="boto4" name="entra" value="T A F A N E J A" onclick="tafaneja()" type="button"> &nbsp;T A F A N E J A&nbsp; </button> <br/> </div> </div> <div class="col-esq"> <a style="text-align:left" href="javascript:comprova()" onmouseover="window.status='Aquesta pàgina compleix els estàndards XHTML 1.1!'; return true" onmouseout="treuretext()"><img src="valid-xhtml11.png" alt="Aquesta pàgina compleix els estàndards XHTML 1.1!" height="31" width="88" /></a> </div> <div class="cright"> <script type="text/javascript"> // <![CDATA[ document.write(copyright) // ]]> </script> <a class='mini' href='javascript:guerra_nav()' onmouseover="window.status='Vés a la guerra dels navegadors';return true" onmouseout="treuretext()">Per si no ho sabíeu, a aquesta pàgina li agrada veure's amb el Mozilla (També, si cal, amb el Netscape 7 i l'Internet Exploiter 5)</a> </div> </body> </html>
This isn't a blocker.
Severity: blocker → normal
I saved the example as calaix.xml and tried to load it from disk, but got: XML Parsing Error: mismatched tag. Expected: </body>. Location: file:///E:/_MozBin/_Bugs/215904/calaix.xml Line Number 135, Column 3:</div> After removing that </div>, it is the second one after the line '&nbsp;T A F A N E J A&nbsp;' the page displayed, of course not well, because some files ( .css, .js ) are missing.
This has nothing to do with the JS console. document.write is not supported in XHTML and there are no plans to support it there. Is that what causes the problems here?
Assignee: hewitt → dom_bugs
Component: JavaScript Console → DOM Level 0
QA Contact: jrgm → ashishbhatt
XHTML 1.1 (application/xhtml+xml) - is XML. document.write() is a part of HTML DOM: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268 and that is why it works on HTML documents. but it is not part of XML DOM: http://www.w3.org/TR/DOM-Level-2-Core/core.html#i-Document and that is why it doesn't work with XHTML. INVALID.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
*** This bug has been marked as a duplicate of 68193 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.