HTMLOutputElement
sealed class HTMLOutputElement : HTMLFormControlElement, IHtmlOutputElement, IHtmlElement, IElement, INode, IEventTarget, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IValidation
Represents an HTML output element.
using AngleSharp.DOM.Collections;
using AngleSharp.DOM.Css;
using AngleSharp.Html;
namespace AngleSharp.DOM.Html
{
internal sealed class HTMLOutputElement : HTMLFormControlElement, IHtmlOutputElement, IHtmlElement, IElement, INode, IEventTarget, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IValidation
{
private bool isDefaultValue;
private string _defaultValue;
private SettableTokenList _for;
public string DefaultValue {
get {
return _defaultValue ?? TextContent;
}
set {
_defaultValue = value;
}
}
public string Value {
get {
return TextContent;
}
set {
if (isDefaultValue) {
_defaultValue = Value;
isDefaultValue = false;
}
TextContent = value;
}
}
public ISettableTokenList HtmlFor {
get {
if (_for == null) {
_for = new SettableTokenList(GetAttribute(AttributeNames.For));
_for.Changed += delegate {
UpdateAttribute(AttributeNames.For, _for.Value);
};
}
return _for;
}
}
public string Type => Tags.Output;
internal HTMLOutputElement()
: base(Tags.Output, NodeFlags.None)
{
isDefaultValue = true;
}
internal override void Reset()
{
if (!isDefaultValue) {
TextContent = _defaultValue;
isDefaultValue = true;
}
}
}
}