Js-beautify: Beautification problem with JS Single Line Comment <!--

Created on 31 Aug 2020  路  2Comments  路  Source: beautify-web/js-beautify

In Javascript <!-- is treated as a single-line comment just like //.

js-beautify works as expected when the line starts with <!--:

Input:
<!--alert(1)commented

Output:
<!--alert(1)commented

Otherwise it will break the syntax:

Input:
alert(1)<!--commented

Output:
alert(1) < !--commented

good first issue bug

Most helpful comment

Please refer to annex B1.3 of the ES6 espec.
https://www.ecma-international.org/ecma-262/11.0/index.html#prod-annexB-SingleLineHTMLOpenComment

B.1.3 HTML-like Comments

Comment::
MultiLineComment
SingleLineComment
SingleLineHTMLOpenComment
SingleLineHTMLCloseComment
SingleLineDelimitedComment

SingleLineHTMLOpenComment::