From a0326a15f29aa03efdd656f4eb9504f3839277a1 Mon Sep 17 00:00:00 2001
From: Simon Pieters
Date: Tue, 31 May 2016 15:46:13 +0200
Subject: [PATCH] Make dashes in comments no longer be parse errors
The spec disallowed dashes in comments in order to have conformance
checkers point out the problem for pre-2006 Firefox that implemented
SGML-style comment parsing, and to match the syntax requirements in
HTML4 and XML. These are no longer relevant and instead people are
getting unhelpful error messages when validating for markup like:
* A comment that ends with a dash is now allowed:
* A comment that contains -- is also allowed:
* A comment that contains --! is also allowed:
* The following are still parse errors: , ,
Fixes #1351.
Also remove obsolete comments in the spec's source about rewinding
when hitting EOF (see #1058).
---
source | 45 ++++++++++++++++++++-------------------------
1 file changed, 20 insertions(+), 25 deletions(-)
diff --git a/source b/source
index 0b6be4081f7..d5130b7bf66 100644
--- a/source
+++ b/source
@@ -1497,10 +1497,11 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
When a user agent based on XML is connected to an HTML parser, it is possible that certain
- invariants that XML enforces, such as comments never containing two consecutive hyphens, will be
- violated by an HTML file. Handling this can require that the parser coerce the HTML DOM into an
- XML-compatible infoset. Most syntax constructs that require such handling are considered
- invalid.
+ invariants that XML enforces, such as element or attribute names never contain multiple colons,
+ will be violated by an HTML file. Handling this can require that the parser coerce the HTML DOM
+ into an XML-compatible infoset. Most syntax constructs that require such handling are considered
+ invalid. (Comments containing two consecutive hyphens, or ending with a hyphen, are exceptions
+ that are allowed in the HTML syntax.)
@@ -98256,12 +98257,11 @@ dictionary StorageEventInit : EventInit {
Comments must start with the four character sequence U+003C
LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS (<!--
). Following this sequence, the comment may have text, with the additional restriction that the text must not start with
- a single U+003E GREATER-THAN SIGN character (>), nor start with a U+002D HYPHEN-MINUS character
- (-) followed by a U+003E GREATER-THAN SIGN (>) character, nor contain two consecutive U+002D
- HYPHEN-MINUS characters (--
), nor end with a U+002D HYPHEN-MINUS character
- (-). Finally, the comment must be ended by the three character sequence U+002D HYPHEN-MINUS,
- U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN (-->
).
+ data-x="syntax-text">text, with the additional restriction that the text must not start
+ with a single U+003E GREATER-THAN SIGN character (>), nor start with a U+002D HYPHEN-MINUS
+ character (-) followed by a U+003E GREATER-THAN SIGN (>) character. Finally, the comment must
+ be ended by the three character sequence U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E
+ GREATER-THAN SIGN (-->
).
@@ -101166,7 +101166,6 @@ dictionary StorageEventInit : EventInit {
U+003E GREATER-THAN SIGN (>)
Parse error. Switch to the data state. Emit the comment token.
-
EOF
Parse error. Emit the comment token. Reconsume in the data
@@ -101197,7 +101196,7 @@ dictionary StorageEventInit : EventInit {
EOF
Parse error. Emit the comment token. Reconsume in the data
- state.
+ state.
Anything else
Append a U+002D HYPHEN-MINUS character (-) and the current input character to
@@ -101221,7 +101220,7 @@ dictionary StorageEventInit : EventInit {
EOF
Parse error. Switch to the data state. Emit the comment token.
- Reconsume the EOF character.
+ Reconsume the EOF character.
Anything else
Append the current input character to the comment token's data.
@@ -101244,7 +101243,7 @@ dictionary StorageEventInit : EventInit {
EOF
Parse error. Switch to the data state. Emit the comment token.
- Reconsume the EOF character.
+ Reconsume the EOF character.
Anything else
Append a U+002D HYPHEN-MINUS character (-) and the current input character to
@@ -101268,22 +101267,18 @@ dictionary StorageEventInit : EventInit {
state.
U+0021 EXCLAMATION MARK (!)
- Parse error. Switch to the comment end bang state.
+ Switch to the comment end bang state.
U+002D HYPHEN-MINUS (-)
- Parse error. Append a U+002D HYPHEN-MINUS character (-) to the comment token's
- data.
+ Append a U+002D HYPHEN-MINUS character (-) to the comment token's data.
EOF
Parse error. Emit the comment token. Reconsume in the data
- state.
+ state.
Anything else
- Parse error. Append two U+002D HYPHEN-MINUS characters (-) and the current
- input character to the comment token's data. Switch to the comment
- state.
+ Append two U+002D HYPHEN-MINUS characters (-) and the current input character to
+ the comment token's data. Switch to the comment state.
@@ -101299,7 +101294,7 @@ dictionary StorageEventInit : EventInit {
the comment token's data. Switch to the comment end dash state.
U+003E GREATER-THAN SIGN (>)
- Switch to the data state. Emit the comment token.
+ Parse error. Switch to the data state. Emit the comment token.
U+0000 NULL
Parse error. Append two U+002D HYPHEN-MINUS characters (-), a U+0021 EXCLAMATION
@@ -101308,7 +101303,7 @@ dictionary StorageEventInit : EventInit {
EOF
Parse error. Emit the comment token. Reconsume in the data
- state.
+ state.
Anything else
Append two U+002D HYPHEN-MINUS characters (-), a U+0021 EXCLAMATION MARK character (!), and