AngleSharp by AngleSharp

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

.NET API 1,204,224 bytes

 HtmlOptionElement

Represents the HTML option element.
using AngleSharp.Dom.Css; using AngleSharp.Dom.Events; using AngleSharp.Extensions; using AngleSharp.Html; namespace AngleSharp.Dom.Html { internal sealed class HtmlOptionElement : HtmlElement, IHtmlOptionElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IGlobalEventHandlers { private bool? _selected; public bool IsDisabled { get { return this.HasOwnAttribute(AttributeNames.Disabled); } set { this.SetOwnAttribute(AttributeNames.Disabled, value ? string.Empty : null, false); } } public IHtmlFormElement Form => GetAssignedForm(); public string Label { get { return this.GetOwnAttribute(AttributeNames.Label) ?? Text; } set { this.SetOwnAttribute(AttributeNames.Label, value, false); } } public string Value { get { return this.GetOwnAttribute(AttributeNames.Value) ?? Text; } set { this.SetOwnAttribute(AttributeNames.Value, value, false); } } public int Index { get { HtmlOptionsGroupElement htmlOptionsGroupElement = base.Parent as HtmlOptionsGroupElement; if (htmlOptionsGroupElement != null) { int num = 0; foreach (INode childNode in htmlOptionsGroupElement.ChildNodes) { if (childNode == this) return num; num++; } } return 0; } } public string Text { get { return TextContent.CollapseAndStrip(); } set { TextContent = value; } } public bool IsDefaultSelected { get { return this.HasOwnAttribute(AttributeNames.Selected); } set { this.SetOwnAttribute(AttributeNames.Selected, value ? string.Empty : null, false); } } public bool IsSelected { get { if (!_selected.HasValue) return IsDefaultSelected; return _selected.Value; } set { _selected = value; } } public HtmlOptionElement(Document owner, string prefix = null) : base(owner, TagNames.Option, prefix, NodeFlags.ImplicitelyClosed | NodeFlags.ImpliedEnd | NodeFlags.HtmlSelectScoped) { } } }