File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- const tagRE = / < [ a - z A - Z \- \! \/ ] (?: " [ ^ " ] * " | ' [ ^ ' ] * ' | [ ^ ' " > ] ) * > / g
1+ const tagRE = / < [ a - z A - Z 0 - 9 \- \! \/ ] (?: " [ ^ " ] * " | ' [ ^ ' ] * ' | [ ^ ' " > ] ) * > / g
22import parseTag from './parse-tag'
33
44// re-used obj for quick lookups of components
Original file line number Diff line number Diff line change @@ -230,6 +230,57 @@ test('parse', function (t) {
230230 ] )
231231 t . equal ( html , HTML . stringify ( parsed ) )
232232
233+ html = '<0>oh <1>hello</1> there! How are <2>you</2>?</0>'
234+ parsed = HTML . parse ( html )
235+
236+ t . deepEqual ( parsed , [
237+ {
238+ type : 'tag' ,
239+ name : '0' ,
240+ attrs : { } ,
241+ voidElement : false ,
242+ children : [
243+ {
244+ type : 'text' ,
245+ content : 'oh ' ,
246+ } ,
247+ {
248+ type : 'tag' ,
249+ name : '1' ,
250+ attrs : { } ,
251+ voidElement : false ,
252+ children : [
253+ {
254+ type : 'text' ,
255+ content : 'hello' ,
256+ } ,
257+ ] ,
258+ } ,
259+ {
260+ type : 'text' ,
261+ content : ' there! How are ' ,
262+ } ,
263+ {
264+ type : 'tag' ,
265+ name : '2' ,
266+ attrs : { } ,
267+ voidElement : false ,
268+ children : [
269+ {
270+ type : 'text' ,
271+ content : 'you' ,
272+ } ,
273+ ] ,
274+ } ,
275+ {
276+ type : 'text' ,
277+ content : '?' ,
278+ } ,
279+ ] ,
280+ } ,
281+ ] )
282+ t . equal ( html , HTML . stringify ( parsed ) )
283+
233284 html = '<div class="handles multiple classes" and="attributes"></div>'
234285 parsed = HTML . parse ( html )
235286
You can’t perform that action at this time.
0 commit comments