HtmlMenuItemElement
sealed class HtmlMenuItemElement : HtmlElement, IHtmlMenuItemElement, IHtmlElement, IElement, INode, IEventTarget, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle
Represents the HTML menuitem element.
using AngleSharp.Dom.Css;
using AngleSharp.Html;
namespace AngleSharp.Dom.Html
{
internal sealed class HtmlMenuItemElement : HtmlElement, IHtmlMenuItemElement, IHtmlElement, IElement, INode, IEventTarget, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle
{
public enum ItemType : ushort
{
Command,
Checkbox,
Radio
}
internal bool IsVisited { get; set; }
internal bool IsActive { get; set; }
public IHtmlElement Command {
get {
string attribute = GetAttribute(AttributeNames.Command);
if (!string.IsNullOrEmpty(attribute) && base.Owner != null)
return base.Owner.GetElementById(attribute) as IHtmlElement;
return null;
}
}
public string Type {
get {
return GetAttribute(AttributeNames.Type);
}
set {
SetAttribute(AttributeNames.Type, value);
}
}
public string Label {
get {
return GetAttribute(AttributeNames.Label);
}
set {
SetAttribute(AttributeNames.Label, value);
}
}
public string Icon {
get {
return GetAttribute(AttributeNames.Icon);
}
set {
SetAttribute(AttributeNames.Icon, value);
}
}
public bool IsDisabled {
get {
return GetAttribute(AttributeNames.Disabled) != null;
}
set {
SetAttribute(AttributeNames.Disabled, value ? string.Empty : null);
}
}
public bool IsChecked {
get {
return GetAttribute(AttributeNames.Checked) != null;
}
set {
SetAttribute(AttributeNames.Checked, value ? string.Empty : null);
}
}
public bool IsDefault {
get {
return GetAttribute(AttributeNames.Default) != null;
}
set {
SetAttribute(AttributeNames.Default, value ? string.Empty : null);
}
}
public string RadioGroup {
get {
return GetAttribute(AttributeNames.Radiogroup);
}
set {
SetAttribute(AttributeNames.Radiogroup, value);
}
}
public HtmlMenuItemElement(Document owner)
: base(owner, Tags.MenuItem, NodeFlags.SelfClosing | NodeFlags.Special)
{
}
}
}