HtmlProgressElement
sealed class HtmlProgressElement : HtmlElement, ILabelabelElement, IHtmlProgressElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle
Represents the HTML progress element.
https://html.spec.whatwg.org/multipage/forms.html#the-progress-element
using AngleSharp.Dom.Collections;
using AngleSharp.Dom.Css;
using AngleSharp.Extensions;
using AngleSharp.Html;
using System;
using System.Globalization;
namespace AngleSharp.Dom.Html
{
internal sealed class HtmlProgressElement : HtmlElement, ILabelabelElement, IHtmlProgressElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle
{
private readonly NodeList labels;
public bool SupportsLabels => true;
public INodeList Labels => labels;
public bool IsDeterminate => !string.IsNullOrEmpty(GetOwnAttribute(AttributeNames.Value));
public double Value {
get {
return GetOwnAttribute(AttributeNames.Value).ToDouble(0);
}
set {
SetOwnAttribute(AttributeNames.Value, value.ToString(NumberFormatInfo.InvariantInfo));
}
}
public double Maximum {
get {
return GetOwnAttribute(AttributeNames.Max).ToDouble(1);
}
set {
SetOwnAttribute(AttributeNames.Max, value.ToString(NumberFormatInfo.InvariantInfo));
}
}
public double Position {
get {
if (!IsDeterminate)
return -1;
return Math.Max(Math.Min(Value / Maximum, 1), 0);
}
}
public HtmlProgressElement(Document owner, string prefix = null)
: base(owner, Tags.Progress, prefix, NodeFlags.None)
{
labels = new NodeList();
}
}
}