Skip to content

Commit b074875

Browse files
committed
[javascript mode] Only allow HTML-style comments at the start of line
Closes codemirror#6305
1 parent 91cb294 commit b074875

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

mode/javascript/javascript.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
103103
return ret("meta", "meta");
104104
} else if (ch == "#" && stream.eatWhile(wordRE)) {
105105
return ret("variable", "property")
106-
} else if (ch == "<" && stream.match("!--") || ch == "-" && stream.match("->")) {
106+
} else if ((ch == "<" && stream.match("!--") || ch == "-" && stream.match("->")) &&
107+
!/\S/.test(stream.string.slice(0, stream.start))) {
107108
stream.skipToEnd()
108109
return ret("comment", "comment")
109110
} else if (isOperatorChar.test(ch)) {

0 commit comments

Comments
 (0)