예제 #1
0
        public HtmlTag WithNonEmptyAttribute(string name, object value)
        {
            if (value != null && !HaveAttribute(name))
            {
                var attribute = new HtmlAttribute(name, this);
                attribute.WithValue(value);
                _attributes.Add(attribute.Name, attribute);
            }

            return this;
        }
예제 #2
0
        public HtmlTag WithEmptyAttribute(string name)
        {
            if (!HaveAttribute(name))
            {
                var attr = new HtmlAttribute(name, this);
                attr.WithNovalue();
                _attributes.Add(attr.Name, attr);
            }

            return this;
        }
예제 #3
0
 public HtmlTag WithAttribute(string name, object value)
 {
     if (!HaveAttribute(name))
     {
         var attribute = new HtmlAttribute(name, this);
         if (value == null)
         {
             attribute.WithNovalue();
         }
         else
         {
             attribute.WithValue(value);
             _attributes.Add(attribute.Name, attribute);
         }
     }
     return this;
 }