File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ module.exports = function parse(html, options) {
36
36
inComponent = true ;
37
37
}
38
38
39
- if ( ! inComponent && nextChar && nextChar !== '<' ) {
39
+ if ( ! current . voidElement && ! inComponent && nextChar && nextChar !== '<' ) {
40
40
current . children . push ( {
41
41
type : 'text' ,
42
42
content : html . slice ( start , html . indexOf ( '<' , start ) )
Original file line number Diff line number Diff line change @@ -270,6 +270,28 @@ test('parse', function (t) {
270
270
]
271
271
} ] , 'should handle registered void tags if self-closing' ) ;
272
272
273
+
274
+ html = '<div> 9 <input type="text"/> 10 </div>' ;
275
+ parsed = HTML . parse ( html ) ;
276
+ t . deepEqual ( parsed , [ {
277
+ type : 'tag' ,
278
+ name : 'div' ,
279
+ attrs : { } ,
280
+ voidElement : false ,
281
+ children : [
282
+ { type : 'text' , content : ' 9 ' } ,
283
+ {
284
+ type : 'tag' ,
285
+ name : 'input' ,
286
+ attrs : {
287
+ type : 'text'
288
+ } ,
289
+ children : [ ] ,
290
+ voidElement : true ,
291
+ } ,
292
+ { type : 'text' , content : ' 10 ' } ,
293
+ ]
294
+ } ] , 'should not give voidElements children' ) ;
273
295
t . end ( ) ;
274
296
} ) ;
275
297
You can’t perform that action at this time.
0 commit comments