private static bool CanRemoveEmptyAttribute(HtmlTag tag, HtmlAttribute attribute)
{
string tagNameInLowercase = tag.NameInLowercase;
string attributeNameInLowercase = attribute.NameInLowercase;
string attributeValue = attribute.Value;
HtmlAttributeType attributeType = attribute.Type;
bool result = false;
bool isZeroLengthString = attributeValue.Length == 0;
if (isZeroLengthString || string.IsNullOrWhiteSpace(attributeValue))
{
if (tagNameInLowercase == "input" && attributeNameInLowercase == "value")
{
result = isZeroLengthString;
}
else if (attributeType == HtmlAttributeType.Event
|| (tagNameInLowercase == "form" && attributeNameInLowercase == "action")
|| _emptyAttributesForRemoval.Contains(attributeNameInLowercase))
{
result = true;
}
}
return result;
}