BaseTag<T> Interface
Represents basic features of an HTML element.
public interface BaseTag<out T>
where T : BaseTag<T>
Type Parameters
The type of an HTML element.
Properties
Name |
Gets the name of this tag in lowercase letters. |
Methods
With |
Gets a new BaseTag<T> object with the |
With |
Gets a new BaseTag<T> object with the |
Add |
Gets a new BaseTag<T> object with the |
Add |
Gets a new BaseTag<T> object with the specified attribute that has the specified value. |
Add |
Gets a new BaseTag<T> object with the specified empty attribute. |
Properties Detail
Name
Gets the name of this tag in lowercase letters.
string Name { get; }
Property Value
Methods Detail
WithId(string)
Gets a new BaseTag<T> object with the id
attribute
that has the specified value.
T WithId(string id)
Parameters
- id
- string
The value of the id
attribute.
Returns
The new BaseTag<T> object.
WithClass(string[])
Gets a new BaseTag<T> object with the class
attribute that has the specified values.
T WithClass(params string[] values)
Parameters
- values
- string[]
The values of the class
attribute.
Returns
The new BaseTag<T> object.
AddClass(string[])
Gets a new BaseTag<T> object with the class
attribute that has both the values of this object and the specified
values.
T AddClass(params string[] values)
Parameters
- values
- string[]
The adding values of the class
attribute.
Returns
The new BaseTag<T> object.
AddAttributes((string Name, string Value)[])
Gets a new BaseTag<T> object with the specified attribute that has the specified value.
T AddAttributes(params (string Name, string Value)[] attributes)
Parameters
- attributes
- (string Name, string Value)[]
Tuples of the name and value representing an attribute. If the value of
the tuple is null
, it represents the empty attribute.
Returns
The new BaseTag<T> object.
AddEmptyAttributes(string[])
Gets a new BaseTag<T> object with the specified empty attribute.
T AddEmptyAttributes(params string[] attributeNames)
Parameters
- attributeNames
- string[]
The name of the empty attribute.
Returns
The new BaseTag<T> object.
Remarks
An invocation of this method of the form
tag.AddEmptyAttributes(n1, n2)
behaves in exactly the same way
as the invocation tag.AddAttributes((n1, null), (n2,
null))
.
The web browser interprets the value of the empty attribute as
the empty string implicitly. So, for example, <input
disabled>
is equivalent to <input disabled="">
. The
former can be generated with AddEmptyAttributes("disabled")
or
AddAttributes(("disabled", null))
, and the latter with
AddAttributes(("disabled", ""))
.