File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -108,21 +108,19 @@ public bool Consume()
108108 {
109109 Debug . Assert ( IsConsumable ( ) ) ;
110110 var peekedOriginChar = PeekNextOriginChar ( ) ;
111- if ( peekedOriginChar == '<' )
111+ // Only consume the start tag if a tag closing bracket (>) was found.
112+ var isStartTag = peekedOriginChar == '<' && IsNextTagBracketClosing ( consumedLength + 1 ) ;
113+ var isEndTag = peekedOriginChar == '<' && PeekNextNextOriginChar ( ) == '/' ;
114+ if ( isStartTag || isEndTag )
112115 {
113- if ( PeekNextNextOriginChar ( ) == '/' )
116+ if ( isEndTag )
114117 {
115118 ConsumeEndTag ( ) ;
116119 }
117- else if ( IsNextTagBracketClosing ( consumedLength + 1 ) ) //Only consume the start tag if a tag closing bracket (>) was found.
120+ else if ( isStartTag )
118121 {
119122 ConsumeStartTag ( ) ;
120123 }
121- else
122- {
123- ConsumeRawChar ( ) ;
124- return true ;
125- }
126124
127125 if ( IsConsumable ( ) )
128126 {
@@ -154,7 +152,7 @@ private char PeekNextOriginChar()
154152 return originalText [ consumedLength ] ;
155153 }
156154
157- //Returns if the first tag bracket found in the string is '>', as opposed to '<'
155+ // Returns if the first tag bracket found in the string is '>', as opposed to '<'
158156 private bool IsNextTagBracketClosing ( int charIndexToStartSearch = 0 )
159157 {
160158 int bracketIndex = originalText . IndexOfAny ( tagBrackets , charIndexToStartSearch ) ;
You can’t perform that action at this time.
0 commit comments