Re: Stray start tag script. Suggested help message

2014-07-18 19:29, Jerry Pank wrote:

>   Stray start tag script.

You are apparently using the experimental validation, against the 
experimental HTML5. When validating against HTML 4.01, the error message 
is different.

 > (referring to Javascript in this instance)

Use of JavaScript is irrelevant here. The content of the script element 
does not matter here.

> I spent a long while trying to resolve this error.  I transpired that
> the block of Javascript was outside of the closing body tag.

Well, close. The script element appears after the body element, after 
the </body> tag. This, by the way, demonstrates why verbose markup, 
often promoted for clarity, may in fact cause problems. The </body> tag 
is optional, but if you use it, there must be no elements after it; the 
only markup that may appear after it is the end tag </html>.

> If your validator could prompt the visitor to check the Javscript in
> included within the body tags, it would be very helpful.

The point here is that nothing except </html> is allowed after the 
</body> tag. But this is not a separate rule, just a consequence of 
syntax rules: the root element (html) must contain only the head element 
and the body element, in that order.

In HTML 4.01 validation, the error message is

document type does not allow element "SCRIPT" here

To me, this looks more understandable than "Stray start tag script".

I don't know in which conditions "Stray start tag ..." may appear, but 
if it is limited to processing data after </html>, then it could 
hopefully be tuned somewhat, e.g. to "Element ... appears after end of 
body body element" or something like that.

Yucca

Received on Saturday, 19 July 2014 12:59:49 UTC