private static bool CanRemoveAttributeQuotes(HtmlAttribute attribute,
HtmlAttributeQuotesRemovalMode attributeQuotesRemovalMode)
{
string attributeValue = attribute.Value;
bool result = false;
if (attributeQuotesRemovalMode != HtmlAttributeQuotesRemovalMode.KeepQuotes)
{
if (!attributeValue.EndsWith("/"))
{
if (attributeQuotesRemovalMode == HtmlAttributeQuotesRemovalMode.Html4)
{
result = _html4AttributeValueNotRequireQuotesRegex.IsMatch(attributeValue);
}
else if (attributeQuotesRemovalMode == HtmlAttributeQuotesRemovalMode.Html5)
{
result = CommonRegExps.Html5AttributeValueNotRequireQuotes.IsMatch(attributeValue);
}
}
}
return result;
}