public static IChain <T> JoinCustom <T> (this IChain <T> attributes, IEnumerable <HAttribute> customAttributes) where T : HAttribute, new () { if (customAttributes == null) { return(attributes); } return(attributes.Join(new Chain <T> (customAttributes.Where(a => a != null).Select(a => (T) new T().Create(a.Name, a.Value))))); }
// this can be improved in the future to intelligently merge other types of attributes. // css is however the most common case. /// <summary> /// Merges two attribute chains with css-awareness. Unlike Join, which merely concatenate two chains, /// Merge merges multiple css attributes into a single css attribute. /// </summary> public static IChain <T> Merge <T> (this IChain <T> x, ChainFunc <T> func) where T : HAttribute, new() { return(x.Join(func).MergeCssAttributes()); }
public static IChain <T> Custom <T> (this IChain <T> attributes, HAttribute attribute) where T : HAttribute, new () { return(attributes.Join((T) new T().Create(attribute.Name, attribute.Value))); }
public static IChain <T> Custom <T> (this IChain <T> attributes, string name, object value) where T : HAttribute, new() { return(attributes.Join((T) new T().Create(name, value))); }
public static IChain <T> Join <T> (this IChain <T> x, ChainFunc <T> func) { return(x.Join(func == null ? null : func(null))); }
public static IChain <T> Join <T> (this IChain <T> x, T y) { return(x.Join(new Chain <T> (new[] { y }))); }