WebMarkupMin.Core.GenericHtmlMinifier.IsAttributeRedundant C# (CSharp) Метод

IsAttributeRedundant() приватный статический Метод

Checks whether the attribute is redundant
private static IsAttributeRedundant ( WebMarkupMin.Core.Parsers.HtmlTag tag, HtmlAttribute attribute ) : bool
tag WebMarkupMin.Core.Parsers.HtmlTag Tag
attribute WebMarkupMin.Core.Parsers.HtmlAttribute Attribute
Результат bool
        private static bool IsAttributeRedundant(HtmlTag tag, HtmlAttribute attribute)
        {
            string tagNameInLowercase = tag.NameInLowercase;
            IList<HtmlAttribute> attributes = tag.Attributes;
            string attributeNameInLowercase = attribute.NameInLowercase;
            string attributeValue = attribute.Value;
            string processedAttributeValue = attributeValue.Trim();

            return (
                (tagNameInLowercase == "script"
                    && ((attributeNameInLowercase == "language" && processedAttributeValue.IgnoreCaseEquals("javascript"))
                    || (attributeNameInLowercase == "charset" && attributes.All(a => a.NameInLowercase != "src"))))
                || (tagNameInLowercase == "link" && attributeNameInLowercase == "charset" && attributes.Any(
                    a => a.NameInLowercase == "rel" && a.Value.Trim().IgnoreCaseEquals("stylesheet")))
                || (tagNameInLowercase == "form" && attributeNameInLowercase == "method"
                    && processedAttributeValue.IgnoreCaseEquals("get"))
                || (tagNameInLowercase == "input" && attributeNameInLowercase == "type"
                    && processedAttributeValue.IgnoreCaseEquals("text"))
                || (tagNameInLowercase == "a" && attributeNameInLowercase == "name" && attributes.Any(
                    a => a.NameInLowercase == "id" && a.Value == attributeValue))
                || (tagNameInLowercase == "area" && attributeNameInLowercase == "shape"
                    && processedAttributeValue.IgnoreCaseEquals("rect"))
            );
        }