示例#1
0
        public static void AddClass(this TagHelperAttributeList attrList, string cssClass)
        {
            var attrs = attrList.Where(a => a.Name.Equals("class"));

            if (attrs.Count() == 1)
            {
                TagHelperAttribute classAttr = attrs.First();
                attrList.Remove(classAttr);
                attrList.Add(new TagHelperAttribute("class", $"{classAttr.Value} autocomplete"));
            }
        }
示例#2
0
 private List <TagHelperAttribute> GetTabAttributesByPrefix(TagHelperAttributeList attributes, string prefix)
 {
     return(attributes.Where(a => a.Name.StartsWith(prefix))
            .Select(a => new TagHelperAttribute(a.Name.Substring(prefix.Length), a.Value)).ToList());
 }
 public static void Remove(this TagHelperAttributeList list, params string[] attributeNamesToRemove)
 {
     list.Where(a => attributeNamesToRemove.Contains(a.Name)).ForEach(a => list.Remove(a));
 }