예제 #1
0
        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)))));
        }
예제 #2
0
        // 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());
        }
예제 #3
0
 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)));
 }
예제 #4
0
 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)));
 }
예제 #5
0
 public static IChain <T> Join <T> (this IChain <T> x, ChainFunc <T> func)
 {
     return(x.Join(func == null ? null : func(null)));
 }
예제 #6
0
 public static IChain <T> Join <T> (this IChain <T> x, T y)
 {
     return(x.Join(new Chain <T> (new[] { y })));
 }