We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 346c5e2 commit 7703d81Copy full SHA for 7703d81
1 file changed
src/HtmlAgilityPack.Shared/HtmlDocument.cs
@@ -1741,8 +1741,16 @@ private void Parse()
1741
// check buffer end
1742
if ((_currentnode._namelength + 3) <= (Text.Length - (_index - 1)))
1743
{
1744
- if (string.Compare(Text.Substring(_index - 1, _currentnode._namelength + 2),
1745
- "</" + _currentnode.Name, StringComparison.OrdinalIgnoreCase) == 0)
+ var tagStartMatching = Text[_index - 1] == '<' && Text[_index] == '/';
+ 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)
1754
1755
int c = Text[_index - 1 + 2 + _currentnode.Name.Length];
1756
if ((c == '>') || (IsWhiteSpace(c)))
0 commit comments