HtmlProgressElement
sealed class HtmlProgressElement : HtmlElement, IHtmlProgressElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IGlobalEventHandlers, ILabelabelElement
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.Dom.Events;
using AngleSharp.Extensions;
using AngleSharp.Html;
using System;
using System.Globalization;
namespace AngleSharp.Dom.Html
{
internal sealed class HtmlProgressElement : HtmlElement, IHtmlProgressElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IGlobalEventHandlers, ILabelabelElement
{
private readonly NodeList _labels;
public INodeList Labels => _labels;
public bool IsDeterminate => !string.IsNullOrEmpty(this.GetOwnAttribute(AttributeNames.Value));
public double Value {
get {
return this.GetOwnAttribute(AttributeNames.Value).ToDouble(0);
}
set {
this.SetOwnAttribute(AttributeNames.Value, value.ToString(NumberFormatInfo.InvariantInfo), false);
}
}
public double Maximum {
get {
return this.GetOwnAttribute(AttributeNames.Max).ToDouble(1);
}
set {
this.SetOwnAttribute(AttributeNames.Max, value.ToString(NumberFormatInfo.InvariantInfo), false);
}
}
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, TagNames.Progress, prefix, NodeFlags.None)
{
_labels = new NodeList();
}
}
}