Re: noscript validation issue

On Thu, Feb 03, 2005 at 07:01:15PM +0000, paul@webotech.co.uk wrote:
> 
> If I validate this code: 

> <p>Your currency is set to
> <script language="javascript" type="text/javascript">
> <!--
> document.write('<b>USD<\/b>');
> //-->
> </script>
> <noscript><b>USD</b></noscript>
> ..</p>


> I get this error:
> #Line 17, column 4: end tag for element "P" which is not open 
> 
> However, the code is HTML4.01 compliant if I remove 
> <noscript><b>USD</b></noscript> 
> 
> As far as I am aware I am allowed to embed <noscript> tags within <p> tags,

You aren't. http://w3.org/TR/html4/sgml/dtd.html

<!ENTITY % block
     "P | %heading; | %list; | %preformatted; | DL | DIV | NOSCRIPT |
      BLOCKQUOTE | FORM | HR | TABLE | FIELDSET | ADDRESS">

i.e. "NOSCRIPT is part of that group of elements that are 'block'"

<!ELEMENT P - O (%inline;)*            -- paragraph -->

i.e. "P elements may contain only elements in the group 'inline'"

If you go through the document you will find that there is nothing
that places the elements in the inline group in the block group.

Therefore, since the end tag for <p> is optional, and <noscript> is
not allowed there, starting a <noscript> inside a paragraph implies
closing the paragraph at that point. Thus there is no longer a
paragraph open when the parser reaches the </p>.

-- 
David Dorward                                      http://dorward.me.uk

Received on Friday, 4 February 2005 09:12:18 UTC