This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25925 - Double hyphens validation issue
Summary: Double hyphens validation issue
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-30 14:07 UTC by Nicolas H.
Modified: 2014-06-13 10:18 UTC (History)
2 users (show)

See Also:


Attachments

Description Nicolas H. 2014-05-30 14:07:03 UTC
Hi,

I've had this message when trying to validate a file :  

"Consecutive hyphens did not terminate a comment. -- is not permitted inside a comment, but e.g. - - is"
with also 
"The document is not mappable to XML 1.0 due to two consecutive hyphens in a comment."

To reproduce, put this HTML code in "Direct input validation" in the http://validator.w3.org/

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" class="no-js">

<head>
<meta charset="utf-8" />
<title>Test</title>
<!--
<style>
.block--element {
color : #000;
}</style>
-->

</head>
<body role="document" class="home">

<!--[if lte IE 8]> <div class="block--element">blabla</div> <![endif]-->

<!--<div class="block--element">blabla</div> -->


</html>

It will provide three times the error mentionned above. 

It is problematic for people that are using BEM convention in CSS and conditionnal comments (or simple comments).

(note that it is not breaking display, only validation in the w3 validator)

I don't know what it could imply, is it possible to fix this annoying issue ?


Kind regards,
Nicolas
Comment 1 Ian 'Hixie' Hickson 2014-05-30 18:21:55 UTC
For various complicated historical reasons, you can't put "--" in a comment. Think of it as a way to avoid accidentally putting "-->" or "--!>" in a comment (which would close the comment).

I recommend using a different pattern for BEM class names. For example, instead of using "block-type__element-part" and "block-type--modifier-label", you could use something like "blockType-elementPart" and "blockType-modifierLabel", or maybe even "block-type___element-part" and "block-type_-_modifier-label".
Comment 2 Nicolas H. 2014-06-13 10:18:56 UTC
It has over implications, not only for BEM : 

For example : https://twitter.com/HTeuMeuLeu/status/464348018171719680 

<!--<style>--color = #000;</style>-->

Won't validate. 

Such a shame that some sequences are forbidden in HTML comments, other than the end of a comment of course  :-(