diff --git a/src/html/tokenizer.ts b/src/html/tokenizer.ts
index 4b6dcd45..b6e0c5e5 100644
--- a/src/html/tokenizer.ts
+++ b/src/html/tokenizer.ts
@@ -1493,6 +1493,7 @@ export class Tokenizer {
this.appendTokenValue(HYPHEN_MINUS, "HTMLComment")
if (cp !== HYPHEN_MINUS) {
+ this.appendTokenValue(HYPHEN_MINUS, "HTMLComment")
return this.reconsumeAs("COMMENT")
}
cp = this.consumeNextCodePoint()
diff --git a/test/fixtures/ast/comments-2/ast.json b/test/fixtures/ast/comments-2/ast.json
index 05a84701..e9039ec2 100644
--- a/test/fixtures/ast/comments-2/ast.json
+++ b/test/fixtures/ast/comments-2/ast.json
@@ -979,7 +979,7 @@
"column": 15
}
},
- "value": " - "
+ "value": " -- "
},
{
"type": "HTMLComment",
diff --git a/test/fixtures/ast/comments-3/ast.json b/test/fixtures/ast/comments-3/ast.json
new file mode 100644
index 00000000..5d4e705e
--- /dev/null
+++ b/test/fixtures/ast/comments-3/ast.json
@@ -0,0 +1,897 @@
+{
+ "type": "Program",
+ "start": 0,
+ "end": 0,
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 0
+ }
+ },
+ "range": [
+ 0,
+ 0
+ ],
+ "body": [],
+ "sourceType": "script",
+ "comments": [],
+ "tokens": [],
+ "templateBody": {
+ "type": "VElement",
+ "range": [
+ 0,
+ 223
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 15,
+ "column": 11
+ }
+ },
+ "name": "template",
+ "rawName": "template",
+ "namespace": "http://www.w3.org/1999/xhtml",
+ "startTag": {
+ "type": "VStartTag",
+ "range": [
+ 0,
+ 10
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 10
+ }
+ },
+ "selfClosing": false,
+ "attributes": []
+ },
+ "children": [
+ {
+ "type": "VText",
+ "range": [
+ 10,
+ 26
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 4
+ }
+ },
+ "value": "\n Valid:\n "
+ },
+ {
+ "type": "VText",
+ "range": [
+ 34,
+ 39
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 12
+ },
+ "end": {
+ "line": 4,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "VText",
+ "range": [
+ 48,
+ 53
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 13
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "VText",
+ "range": [
+ 63,
+ 68
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 14
+ },
+ "end": {
+ "line": 6,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "VText",
+ "range": [
+ 79,
+ 84
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 15
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "VText",
+ "range": [
+ 94,
+ 99
+ ],
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 14
+ },
+ "end": {
+ "line": 8,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "VText",
+ "range": [
+ 110,
+ 115
+ ],
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 15
+ },
+ "end": {
+ "line": 9,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "VText",
+ "range": [
+ 127,
+ 132
+ ],
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 16
+ },
+ "end": {
+ "line": 10,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "VText",
+ "range": [
+ 145,
+ 150
+ ],
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 17
+ },
+ "end": {
+ "line": 11,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "VText",
+ "range": [
+ 160,
+ 165
+ ],
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 14
+ },
+ "end": {
+ "line": 12,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "VText",
+ "range": [
+ 176,
+ 181
+ ],
+ "loc": {
+ "start": {
+ "line": 12,
+ "column": 15
+ },
+ "end": {
+ "line": 13,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "VText",
+ "range": [
+ 193,
+ 198
+ ],
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 16
+ },
+ "end": {
+ "line": 14,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "VText",
+ "range": [
+ 211,
+ 212
+ ],
+ "loc": {
+ "start": {
+ "line": 14,
+ "column": 17
+ },
+ "end": {
+ "line": 15,
+ "column": 0
+ }
+ },
+ "value": "\n"
+ }
+ ],
+ "endTag": {
+ "type": "VEndTag",
+ "range": [
+ 212,
+ 223
+ ],
+ "loc": {
+ "start": {
+ "line": 15,
+ "column": 0
+ },
+ "end": {
+ "line": 15,
+ "column": 11
+ }
+ }
+ },
+ "variables": [],
+ "tokens": [
+ {
+ "type": "HTMLTagOpen",
+ "range": [
+ 0,
+ 9
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 0
+ },
+ "end": {
+ "line": 1,
+ "column": 9
+ }
+ },
+ "value": "template"
+ },
+ {
+ "type": "HTMLTagClose",
+ "range": [
+ 9,
+ 10
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 9
+ },
+ "end": {
+ "line": 1,
+ "column": 10
+ }
+ },
+ "value": ""
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 10,
+ 15
+ ],
+ "loc": {
+ "start": {
+ "line": 1,
+ "column": 10
+ },
+ "end": {
+ "line": 2,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "HTMLText",
+ "range": [
+ 15,
+ 21
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 4
+ },
+ "end": {
+ "line": 2,
+ "column": 10
+ }
+ },
+ "value": "Valid:"
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 21,
+ 26
+ ],
+ "loc": {
+ "start": {
+ "line": 2,
+ "column": 10
+ },
+ "end": {
+ "line": 3,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 34,
+ 39
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 12
+ },
+ "end": {
+ "line": 4,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 48,
+ 53
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 13
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 63,
+ 68
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 14
+ },
+ "end": {
+ "line": 6,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 79,
+ 84
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 15
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 94,
+ 99
+ ],
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 14
+ },
+ "end": {
+ "line": 8,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 110,
+ 115
+ ],
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 15
+ },
+ "end": {
+ "line": 9,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 127,
+ 132
+ ],
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 16
+ },
+ "end": {
+ "line": 10,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 145,
+ 150
+ ],
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 17
+ },
+ "end": {
+ "line": 11,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 160,
+ 165
+ ],
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 14
+ },
+ "end": {
+ "line": 12,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 176,
+ 181
+ ],
+ "loc": {
+ "start": {
+ "line": 12,
+ "column": 15
+ },
+ "end": {
+ "line": 13,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 193,
+ 198
+ ],
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 16
+ },
+ "end": {
+ "line": 14,
+ "column": 4
+ }
+ },
+ "value": "\n "
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 211,
+ 212
+ ],
+ "loc": {
+ "start": {
+ "line": 14,
+ "column": 17
+ },
+ "end": {
+ "line": 15,
+ "column": 0
+ }
+ },
+ "value": "\n"
+ },
+ {
+ "type": "HTMLEndTagOpen",
+ "range": [
+ 212,
+ 222
+ ],
+ "loc": {
+ "start": {
+ "line": 15,
+ "column": 0
+ },
+ "end": {
+ "line": 15,
+ "column": 10
+ }
+ },
+ "value": "template"
+ },
+ {
+ "type": "HTMLTagClose",
+ "range": [
+ 222,
+ 223
+ ],
+ "loc": {
+ "start": {
+ "line": 15,
+ "column": 10
+ },
+ "end": {
+ "line": 15,
+ "column": 11
+ }
+ },
+ "value": ""
+ },
+ {
+ "type": "HTMLWhitespace",
+ "range": [
+ 223,
+ 224
+ ],
+ "loc": {
+ "start": {
+ "line": 15,
+ "column": 11
+ },
+ "end": {
+ "line": 16,
+ "column": 0
+ }
+ },
+ "value": "\n"
+ }
+ ],
+ "comments": [
+ {
+ "type": "HTMLComment",
+ "range": [
+ 26,
+ 34
+ ],
+ "loc": {
+ "start": {
+ "line": 3,
+ "column": 4
+ },
+ "end": {
+ "line": 3,
+ "column": 12
+ }
+ },
+ "value": "-"
+ },
+ {
+ "type": "HTMLComment",
+ "range": [
+ 39,
+ 48
+ ],
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 4
+ },
+ "end": {
+ "line": 4,
+ "column": 13
+ }
+ },
+ "value": "--"
+ },
+ {
+ "type": "HTMLComment",
+ "range": [
+ 53,
+ 63
+ ],
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 14
+ }
+ },
+ "value": "---"
+ },
+ {
+ "type": "HTMLComment",
+ "range": [
+ 68,
+ 79
+ ],
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 15
+ }
+ },
+ "value": "----"
+ },
+ {
+ "type": "HTMLComment",
+ "range": [
+ 84,
+ 94
+ ],
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 14
+ }
+ },
+ "value": " - "
+ },
+ {
+ "type": "HTMLComment",
+ "range": [
+ 99,
+ 110
+ ],
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 4
+ },
+ "end": {
+ "line": 8,
+ "column": 15
+ }
+ },
+ "value": " -- "
+ },
+ {
+ "type": "HTMLComment",
+ "range": [
+ 115,
+ 127
+ ],
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 16
+ }
+ },
+ "value": " --- "
+ },
+ {
+ "type": "HTMLComment",
+ "range": [
+ 132,
+ 145
+ ],
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 17
+ }
+ },
+ "value": " ---- "
+ },
+ {
+ "type": "HTMLComment",
+ "range": [
+ 150,
+ 160
+ ],
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 4
+ },
+ "end": {
+ "line": 11,
+ "column": 14
+ }
+ },
+ "value": "a-a"
+ },
+ {
+ "type": "HTMLComment",
+ "range": [
+ 165,
+ 176
+ ],
+ "loc": {
+ "start": {
+ "line": 12,
+ "column": 4
+ },
+ "end": {
+ "line": 12,
+ "column": 15
+ }
+ },
+ "value": "a--a"
+ },
+ {
+ "type": "HTMLComment",
+ "range": [
+ 181,
+ 193
+ ],
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 4
+ },
+ "end": {
+ "line": 13,
+ "column": 16
+ }
+ },
+ "value": "a---a"
+ },
+ {
+ "type": "HTMLComment",
+ "range": [
+ 198,
+ 211
+ ],
+ "loc": {
+ "start": {
+ "line": 14,
+ "column": 4
+ },
+ "end": {
+ "line": 14,
+ "column": 17
+ }
+ },
+ "value": "a----a"
+ }
+ ],
+ "errors": []
+ }
+}
\ No newline at end of file
diff --git a/test/fixtures/ast/comments-3/source.vue b/test/fixtures/ast/comments-3/source.vue
new file mode 100644
index 00000000..d633aa8c
--- /dev/null
+++ b/test/fixtures/ast/comments-3/source.vue
@@ -0,0 +1,15 @@
+
+ Valid:
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/fixtures/ast/comments-3/token-ranges.json b/test/fixtures/ast/comments-3/token-ranges.json
new file mode 100644
index 00000000..cdaadee5
--- /dev/null
+++ b/test/fixtures/ast/comments-3/token-ranges.json
@@ -0,0 +1,34 @@
+[
+ "",
+ "\n ",
+ "Valid:",
+ "\n ",
+ "\n ",
+ "\n ",
+ "\n ",
+ "\n ",
+ "\n ",
+ "\n ",
+ "\n ",
+ "\n ",
+ "\n ",
+ "\n ",
+ "\n ",
+ "\n",
+ "",
+ "\n",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ ""
+]
\ No newline at end of file
diff --git a/test/fixtures/ast/comments-3/tree.json b/test/fixtures/ast/comments-3/tree.json
new file mode 100644
index 00000000..4ec3b769
--- /dev/null
+++ b/test/fixtures/ast/comments-3/tree.json
@@ -0,0 +1,83 @@
+[
+ {
+ "type": "VElement",
+ "text": "\n Valid:\n \n \n \n \n \n \n \n \n \n \n \n \n",
+ "children": [
+ {
+ "type": "VStartTag",
+ "text": "",
+ "children": []
+ },
+ {
+ "type": "VText",
+ "text": "\n Valid:\n ",
+ "children": []
+ },
+ {
+ "type": "VText",
+ "text": "\n ",
+ "children": []
+ },
+ {
+ "type": "VText",
+ "text": "\n ",
+ "children": []
+ },
+ {
+ "type": "VText",
+ "text": "\n ",
+ "children": []
+ },
+ {
+ "type": "VText",
+ "text": "\n ",
+ "children": []
+ },
+ {
+ "type": "VText",
+ "text": "\n ",
+ "children": []
+ },
+ {
+ "type": "VText",
+ "text": "\n ",
+ "children": []
+ },
+ {
+ "type": "VText",
+ "text": "\n ",
+ "children": []
+ },
+ {
+ "type": "VText",
+ "text": "\n ",
+ "children": []
+ },
+ {
+ "type": "VText",
+ "text": "\n ",
+ "children": []
+ },
+ {
+ "type": "VText",
+ "text": "\n ",
+ "children": []
+ },
+ {
+ "type": "VText",
+ "text": "\n ",
+ "children": []
+ },
+ {
+ "type": "VText",
+ "text": "\n",
+ "children": []
+ },
+ {
+ "type": "VEndTag",
+ "text": "",
+ "children": []
+ }
+ ]
+ }
+]
\ No newline at end of file