W3C home > Mailing lists > Public > www-validator@w3.org > September 2015

RE: Issue in validator ?

From: George Weilenmann <george.weilenmann@gohubble.com>
Date: Thu, 3 Sep 2015 13:00:40 +0000
To: Thomas Bouchet <thomas.bouchet@sourismaline.fr>, "www-validator@w3.org" <www-validator@w3.org>
Message-ID: <DB3PR01MB0665971E84DEA01C1D70CF8D8A680@DB3PR01MB0665.eurprd01.prod.exchangelabs.com>
"<!--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: george.weilenmann@gohubble.com
Mobile: +1 720.940.0974 | Office: +1 303.800.5027
Website: gohubble.com

insightsoftware.com is changing! Check out our new Hubble® brand »

-----Original Message-----
From: Thomas Bouchet [mailto:thomas.bouchet@sourismaline.fr]
Sent: Monday, August 31, 2015 6:40 AM
To: www-validator@w3.org
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
(https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements)
:

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
http://sourismaline.fr/


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 insightsoftware.com Group. insightsoftware.com is a registered trademark of insightsoftware.com Limited. Hubble is a registered trademark of insightsoftware.com International Unlimited. Registered in England No. 2860790 at 53-55 Uxbridge Road, Ealing, London, W5 5SA, United Kingdom, VAT Number: GB 766 8160 95
Received on Friday, 4 September 2015 06:09:22 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:18:13 UTC