html-agility-pack icon indicating copy to clipboard operation
html-agility-pack copied to clipboard

IsOverlappedClosingElement: Incorrect Length Check for Minimal Tags

Open otuncelli opened this issue 7 months ago • 0 comments

The current implementation includes the following check:

if (text.Length <= 4)
    return false;

This condition inadvertently excludes valid minimal closing tags like or , which have a length of exactly 4 characters. To accurately assess such tags, the condition should be adjusted to:

if (text.Length < 4)
    return false;

This change ensures that tags with a length of 4 are properly evaluated.

HtmlNode.IsOverlappedClosingElement("</b>"); // Returns false, but should return true

otuncelli avatar May 27 '25 04:05 otuncelli