HtmlTableSectionElement
sealed class HtmlTableSectionElement : HtmlElement, IHtmlTableSectionElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle
Represents the object for HTML table section (thead / tbody / tfoot) elements.
using AngleSharp.Dom.Collections;
using AngleSharp.Dom.Css;
using AngleSharp.Extensions;
using AngleSharp.Html;
namespace AngleSharp.Dom.Html
{
internal sealed class HtmlTableSectionElement : HtmlElement, IHtmlTableSectionElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle
{
private HtmlCollection<IHtmlTableRowElement> _rows;
public HorizontalAlignment Align {
get {
return this.GetOwnAttribute(AttributeNames.Align).ToEnum(HorizontalAlignment.Center);
}
set {
this.SetOwnAttribute(AttributeNames.Align, value.ToString());
}
}
public IHtmlCollection<IHtmlTableRowElement> Rows => _rows ?? (_rows = new HtmlCollection<IHtmlTableRowElement>(this, false, null));
public VerticalAlignment VAlign {
get {
return this.GetOwnAttribute(AttributeNames.Valign).ToEnum(VerticalAlignment.Middle);
}
set {
this.SetOwnAttribute(AttributeNames.Valign, value.ToString());
}
}
public HtmlTableSectionElement(Document owner)
: this(owner, Tags.Tbody, null)
{
}
public HtmlTableSectionElement(Document owner, string name, string prefix = null)
: base(owner, name, prefix, NodeFlags.Special | NodeFlags.ImplicitelyClosed | NodeFlags.HtmlTableSectionScoped)
{
}
public IHtmlTableRowElement InsertRowAt(int index = -1)
{
IHtmlTableRowElement htmlTableRowElement = Rows[index];
IHtmlTableRowElement htmlTableRowElement2 = base.Owner.CreateElement(Tags.Tr) as IHtmlTableRowElement;
if (htmlTableRowElement != null)
InsertBefore(htmlTableRowElement2, htmlTableRowElement);
else
AppendChild(htmlTableRowElement2);
return htmlTableRowElement2;
}
public void RemoveRowAt(int index)
{
Rows[index]?.Remove();
}
}
}