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 1
1
/*jshint -W030 */
2
- var tagRE = / (?: < ! - - [ \S \s ] * - - > | < (?: " [ ^ " ] * " [ ' " ] * | ' [ ^ ' ] * ' [ ' " ] * | [ ^ ' " > ] ) + > ) / g;
2
+ var tagRE = / (?: < ! - - [ \S \s ] * ? - - > | < (?: " [ ^ " ] * " [ ' " ] * | ' [ ^ ' ] * ' [ ' " ] * | [ ^ ' " > ] ) + > ) / g;
3
3
var parseTag = require ( './parse-tag' ) ;
4
4
// re-used obj for quick lookups of components
5
5
var empty = Object . create ? Object . create ( null ) : { } ;
Original file line number Diff line number Diff line change @@ -378,6 +378,24 @@ test('parse', function (t) {
378
378
{ type : 'text' , content : 'Hi' }
379
379
]
380
380
} ] , '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' ) ;
381
399
t . end ( ) ;
382
400
} ) ;
383
401
You can’t perform that action at this time.
0 commit comments