HTMLDialogElement
sealed class HTMLDialogElement : HTMLElement, IHtmlDialogElement, IHtmlElement, IElement, INode, IEventTarget, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle
Represents the object for HTML dialog elements.
using AngleSharp.DOM.Css;
namespace AngleSharp.DOM.Html
{
internal sealed class HTMLDialogElement : HTMLElement, IHtmlDialogElement, IHtmlElement, IElement, INode, IEventTarget, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle
{
private string _returnValue;
public bool Open {
get {
return GetAttribute(AttributeNames.Open) != null;
}
set {
SetAttribute(AttributeNames.Open, value ? string.Empty : null);
}
}
public string ReturnValue {
get {
return _returnValue;
}
set {
_returnValue = value;
}
}
internal HTMLDialogElement()
: base(Tags.Dialog, NodeFlags.None)
{
}
public void Show(IElement anchor = null)
{
Open = true;
}
public void ShowModal(IElement anchor = null)
{
Open = true;
}
public void Close(string returnValue = null)
{
Open = false;
ReturnValue = returnValue;
}
}
}