File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ module.exports = function (tag) {
3838 res . voidElement = true ;
3939 }
4040
41- if ( res . name === '!--' ) { // comment tag
41+ if ( res . name . startsWith ( '!--' ) ) { // comment tag
4242 res = {
4343 type : 'comment' ,
4444 } ;
Original file line number Diff line number Diff line change @@ -84,6 +84,21 @@ test('parse', function (t) {
8484 } ] ) ;
8585 t . equal ( html , HTML . stringify ( parsed ) ) ;
8686
87+ html = '<!---->'
88+ parsed = HTML . parse ( html ) ;
89+ t . deepEqual ( parsed , [ {
90+ type : 'comment' ,
91+ comment : ''
92+ } ] ) ;
93+ t . equal ( html , HTML . stringify ( parsed ) ) ;
94+
95+ html = '<!---this comment starts with a hyphen b/c web developers love curveballs -->'
96+ parsed = HTML . parse ( html ) ;
97+ t . deepEqual ( parsed , [ {
98+ type : 'comment' ,
99+ comment : '-this comment starts with a hyphen b/c web developers love curveballs '
100+ } ] ) ;
101+ t . equal ( html , HTML . stringify ( parsed ) ) ;
87102
88103 html = '<div>oh <strong>hello</strong> there! How are <span>you</span>?</div>' ;
89104 parsed = HTML . parse ( html ) ;
You can’t perform that action at this time.
0 commit comments