File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/HtmlAgilityPack.Shared Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1741,8 +1741,16 @@ private void Parse()
17411741 // check buffer end
17421742 if ( ( _currentnode . _namelength + 3 ) <= ( Text . Length - ( _index - 1 ) ) )
17431743 {
1744- if ( string . Compare ( Text . Substring ( _index - 1 , _currentnode . _namelength + 2 ) ,
1745- "</" + _currentnode . Name , StringComparison . OrdinalIgnoreCase ) == 0 )
1744+ var tagStartMatching = Text [ _index - 1 ] == '<' && Text [ _index ] == '/' ;
1745+ var tagMatching = string . Compare (
1746+ Text ,
1747+ _index + 1 ,
1748+ _currentnode . Name ,
1749+ 0 ,
1750+ _currentnode . _namelength ,
1751+ StringComparison . OrdinalIgnoreCase )
1752+ == 0 ;
1753+ if ( tagStartMatching && tagMatching )
17461754 {
17471755 int c = Text [ _index - 1 + 2 + _currentnode . Name . Length ] ;
17481756 if ( ( c == '>' ) || ( IsWhiteSpace ( c ) ) )
You can’t perform that action at this time.
0 commit comments