@@ -79,15 +79,16 @@ export default class Parser {
7979 // We have to be building a tag or tag data.
8080 if ( buildingTagName ) {
8181 // We're building the tag's name.
82- if ( nextCharacter === "*" && ! currentTagName ) {
82+ if ( nextCharacter === "*" && ! currentTagName && ! buildingClosingTag ) {
8383 // This is a list node closing tag.
8484 const lastStackElement = currentStack [ currentStack . length - 1 ] ;
85- if ( lastStackElement instanceof ListItemNode ) {
85+ if ( lastStackElement . name === "*" ) {
8686 // We finished the last list item.
8787 currentStack . pop ( ) ;
8888 const previousStackElement = currentStack [ currentStack . length - 1 ] ;
8989 previousStackElement . addChild ( lastStackElement ) ;
9090 }
91+ currentTagName += nextCharacter ;
9192 } else if ( nextCharacter === "/" && ! currentTagName ) {
9293 buildingClosingTag = true ;
9394 } else if ( ( [ "]" , " " , "=" ] . includes ( nextCharacter ) ) ) {
@@ -96,7 +97,7 @@ export default class Parser {
9697 if ( this . supportedTagNames . includes ( this . caseSensitive ? currentTagName : currentTagName . toLowerCase ( ) ) && ( ! buildingCode || currentTagName === "code" ) ) {
9798 // The tag name is valid.
9899 if ( nextCharacter === "]" ) {
99- if ( currentTagName === "*" ) {
100+ if ( currentTagName === "*" && ! buildingClosingTag ) {
100101 // This is a list node opening tag.
101102 const listNode = new ListItemNode ( ) ;
102103 currentStack . push ( listNode ) ;
@@ -108,7 +109,7 @@ export default class Parser {
108109 let lastElement = currentStack . pop ( ) ! ;
109110 if ( currentTagName === "list" ) {
110111 // List tag. If the last element is a list item, we need to add it to the previous element.
111- if ( lastElement instanceof ListItemNode ) {
112+ if ( lastElement . name === "*" ) {
112113 const previousElement = currentStack . pop ( ) ! ;
113114 previousElement . addChild ( lastElement ) ;
114115 lastElement = previousElement ;
0 commit comments