AngleSharp by AngleSharp

<PackageReference Include="AngleSharp" Version="0.9.3" />

.NET API 1,218,560 bytes

 HtmlButtonElement

Represents an HTML button element.
using AngleSharp.Dom.Css; using AngleSharp.Extensions; using AngleSharp.Html; namespace AngleSharp.Dom.Html { internal sealed class HtmlButtonElement : HtmlFormControlElement, IHtmlButtonElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IValidation { public string Type { get { return (this.GetOwnAttribute(AttributeNames.Type) ?? InputTypeNames.Submit).ToLower(); } set { this.SetOwnAttribute(AttributeNames.Type, value); } } public string FormAction { get { if (base.Form == null) return string.Empty; return base.Form.Action; } set { if (base.Form != null) base.Form.Action = value; } } public string FormEncType { get { if (base.Form == null) return string.Empty; return base.Form.Enctype; } set { if (base.Form != null) base.Form.Enctype = value; } } public string FormMethod { get { if (base.Form == null) return string.Empty; return base.Form.Method; } set { if (base.Form != null) base.Form.Method = value; } } public bool FormNoValidate { get { if (base.Form == null) return false; return base.Form.NoValidate; } set { if (base.Form != null) base.Form.NoValidate = value; } } public string FormTarget { get { if (base.Form == null) return string.Empty; return base.Form.Target; } set { if (base.Form != null) base.Form.Target = value; } } public string Value { get { return this.GetOwnAttribute(AttributeNames.Value) ?? string.Empty; } set { this.SetOwnAttribute(AttributeNames.Value, value); } } internal bool IsVisited { get; set; } internal bool IsActive { get; set; } public HtmlButtonElement(Document owner, string prefix = null) : base(owner, Tags.Button, prefix, NodeFlags.None) { } public override void DoClick() { IHtmlFormElement form = base.Form; if (!IsClickedCancelled() && form != null) { string type = Type; if (type.Is(InputTypeNames.Submit)) form.Submit(this); else if (type.Is(InputTypeNames.Reset)) { form.Reset(); } } } protected override bool CanBeValidated() { if (Type == InputTypeNames.Submit) return !this.HasDataListAncestor(); return false; } internal override void ConstructDataSet(FormDataSet dataSet, IHtmlElement submitter) { string type = Type; if (object.ReferenceEquals(this, submitter) && type.IsOneOf(InputTypeNames.Submit, InputTypeNames.Reset)) dataSet.Append(base.Name, Value, type); } } }