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

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

Checks whether attribute is the attribute type of tag link or style, that containing CSS code
private static IsCssTypeAttribute ( WebMarkupMin.Core.Parsers.HtmlTag tag, HtmlAttribute attribute ) : bool
tag WebMarkupMin.Core.Parsers.HtmlTag Tag
attribute WebMarkupMin.Core.Parsers.HtmlAttribute Attribute
Результат bool
        private static bool IsCssTypeAttribute(HtmlTag tag, HtmlAttribute attribute)
        {
            string tagNameInLowercase = tag.NameInLowercase;
            string attributeNameInLowercase = attribute.NameInLowercase;
            string attributeValue = attribute.Value;
            IList<HtmlAttribute> attributes = tag.Attributes;
            bool isCssTypeAttribute = false;

            if (tagNameInLowercase == "link" || tagNameInLowercase == "style")
            {
                string processedAttributeValue = attributeValue.Trim();

                if (attributeNameInLowercase == "type" && processedAttributeValue.IgnoreCaseEquals(CSS_CONTENT_TYPE))
                {
                    if (tagNameInLowercase == "link")
                    {
                        isCssTypeAttribute = attributes.Any(a => a.NameInLowercase == "rel"
                            && a.Value.Trim().IgnoreCaseEquals("stylesheet"));
                    }
                    else if (tagNameInLowercase == "style")
                    {
                        isCssTypeAttribute = true;
                    }
                }
            }

            return isCssTypeAttribute;
        }