HtmlMapElement
sealed class HtmlMapElement : HtmlElement, IHtmlMapElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle
Represents the HTML map element.
using AngleSharp.Dom.Collections;
using AngleSharp.Dom.Css;
using AngleSharp.Html;
namespace AngleSharp.Dom.Html
{
internal sealed class HtmlMapElement : HtmlElement, IHtmlMapElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle
{
private HtmlCollection<IHtmlAreaElement> _areas;
private HtmlCollection<IHtmlImageElement> _images;
public string Name {
get {
return GetOwnAttribute(AttributeNames.Name);
}
set {
SetOwnAttribute(AttributeNames.Name, value);
}
}
public IHtmlCollection<IHtmlAreaElement> Areas => _areas ?? (_areas = new HtmlCollection<IHtmlAreaElement>(this, false, null));
public IHtmlCollection<IHtmlImageElement> Images => _images ?? (_images = new HtmlCollection<IHtmlImageElement>(base.Owner.DocumentElement, true, IsAssociatedImage));
public HtmlMapElement(Document owner, string prefix = null)
: base(owner, Tags.Map, prefix, NodeFlags.None)
{
}
private bool IsAssociatedImage(IHtmlImageElement image)
{
string useMap = image.UseMap;
if (!string.IsNullOrEmpty(useMap)) {
string b = (useMap[0] == '#') ? ('#' + Name) : Name;
return useMap == b;
}
return false;
}
}
}