File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 11/*jshint -W030 */
2- var tagRE = / (?: < ! - - [ \S \s ] * - - > | < (?: " [ ^ " ] * " [ ' " ] * | ' [ ^ ' ] * ' [ ' " ] * | [ ^ ' " > ] ) + > ) / g;
2+ var tagRE = / (?: < ! - - [ \S \s ] * ? - - > | < (?: " [ ^ " ] * " [ ' " ] * | ' [ ^ ' ] * ' [ ' " ] * | [ ^ ' " > ] ) + > ) / g;
33var parseTag = require ( './parse-tag' ) ;
44// re-used obj for quick lookups of components
55var empty = Object . create ? Object . create ( null ) : { } ;
Original file line number Diff line number Diff line change @@ -378,6 +378,24 @@ test('parse', function (t) {
378378 { type : 'text' , content : 'Hi' }
379379 ]
380380 } ] , 'should ignore HTML comments' ) ;
381+
382+ html = '<div>Hi <!-- I\'m a nested comment! with a <span></span> --></div><span><!--test--></span>' ;
383+ parsed = HTML . parse ( html ) ;
384+ t . deepEqual ( parsed , [ {
385+ type : 'tag' ,
386+ name : 'div' ,
387+ attrs : { } ,
388+ voidElement : false ,
389+ children : [
390+ { type : 'text' , content : 'Hi ' }
391+ ]
392+ } , {
393+ type : 'tag' ,
394+ name : 'span' ,
395+ attrs : { } ,
396+ voidElement : false ,
397+ children : [ ]
398+ } ] , 'should ignore nested HTML comments' ) ;
381399 t . end ( ) ;
382400} ) ;
383401
You can’t perform that action at this time.
0 commit comments