HtmlMapElement
sealed class HtmlMapElement : HtmlElement, IHtmlMapElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IGlobalEventHandlers
Represents the HTML map element.
using AngleSharp.Dom.Collections;
using AngleSharp.Dom.Css;
using AngleSharp.Dom.Events;
using AngleSharp.Extensions;
using AngleSharp.Html;
namespace AngleSharp.Dom.Html
{
internal sealed class HtmlMapElement : HtmlElement, IHtmlMapElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IGlobalEventHandlers
{
private HtmlCollection<IHtmlAreaElement> _areas;
private HtmlCollection<IHtmlImageElement> _images;
public string Name {
get {
return this.GetOwnAttribute(AttributeNames.Name);
}
set {
this.SetOwnAttribute(AttributeNames.Name, value, false);
}
}
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, TagNames.Map, prefix, NodeFlags.None)
{
}
private bool IsAssociatedImage(IHtmlImageElement image)
{
string useMap = image.UseMap;
if (!string.IsNullOrEmpty(useMap)) {
string other = useMap.Has('#', 0) ? ("#" + Name) : Name;
return useMap.Is(other);
}
return false;
}
}
}