Re: Issue in validator ?


We are tlaking about an HTML validator, right ? Why it should understand
js comments ?

By the way, even by commenting the comment tag for js :
<!doctype html>
<script type="text/javascript">
var a = 1;
//<!--comment in script with false </script> -->
var b = 2;
</script> </body> </html>

I got the same error.
From the doc here :

I understood that only "script starting tag" and "comment closing tag"
are forbidden in a script tag...


On 03/09/2015 15:00, George Weilenmann wrote:
> "<!--comment in script with false" is not valid in JavaScript nor is it a JavaScript comment.
> As a result the validator sees the opening <script> tag then it sees some internal content that should be ignored because it is inside of the script tag, it then encounters the <!-- tag and is then expected the next tag encountered to be the closing tag for <!-- but instead encounters the </script> tag, so it does not have a chance to encounter the --> tag.
> Ways to resolve:
> Use the JavaScript block comment /**/ to wrap around the <!-- --> within  the script [BEST Practice], or
> Place the <!-- --> tags within quotes so that it is treated by JavaScript as a void operation [sub-optimal and JavaScript linting tools will complain].
> George Weilenmann
> CRM Developer
> New email:
> Mobile: +1 720.940.0974 | Office: +1 303.800.5027
> Website:
> is changing! Check out our new Hubble® brand »
> -----Original Message-----
> From: Thomas Bouchet []
> Sent: Monday, August 31, 2015 6:40 AM
> To:
> Subject: Issue in validator ?
> According to validator, this document has a problem :
> <!doctype html>
> <html>
> <head><title>title</title></head>
> <body>
> <script type="text/javascript">
> var a = 1;
> <!--comment in script with false </script> --> var b = 2; </script> </body> </html>
> Error being :
> "The text content of element script was not in the required format:
> Content contains the character sequence <!-- without a later occurrence of the character sequence -->."
> According to your documentation
> (
> :
> inner = < any string that doesn't contain a substring that matches not-in-inner >
> not-in-inner = comment-close / script-open
> So, inside a comment inside a script tag I should not "open" a new script tag. But nothing about closing one... Being into the comment tag, parser should try to find a opening tag or a comment closing tag.
> Where am I wrong ? ;o)
> Regards,
> --
> Thomas Bouchet
> Souris Maline
> Tel: +33 (0)6 63 54 27 78
> Disclaimer: This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this email. Please notify the sender immediately by email if you have received this email by mistake and delete this email from your system. Our company accepts no liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided. Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. Hubble® is a brand name of the Group. is a registered trademark of Limited. Hubble is a registered trademark of I
nternational Unlimited. Registered in England No. 2860790 at 53-55 Uxbridge Road, Ealing, London, W5 5SA, United Kingdom, VAT Number: GB 766 8160 95

Thomas Bouchet
Souris Maline
Tel: +33 (0)6 63 54 27 78

Received on Friday, 4 September 2015 09:23:48 UTC