Re: No error for improperly closed <script> tag

Schneider, Cody wrote:

> Wrong: <script type="text/javascript" src="script.js
> <https://cibng.ibanking-services.com/cib/CEBMainServlet/SplashPageScript
> ?FIORG=592&amp;FIFID=091901215> "/>
[...]
> This may be valid XHTML

It is, therefore a proper validator must not report it as an error. It is 
debatable whether it could and should issue a warning.

> but caused pages to not display at all in
> Firefox and IE

This really depends on how the document is served, on the Content-Type in 
HTTP headers.

If served as text/html, browsers treat <script ... /> as if the "/" were not 
there - so the rest of the document is taken as being inside the script 
element.

If served with an XHTML document type, IE can't handle it at all, whereas 
Firefox processes it by XHTML rules, treating <script ... /> as <script ... 
 ></script> and the document works as expected.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/ 

Received on Thursday, 13 January 2011 20:34:08 UTC