HTMLImageElement
Represents the image element.
namespace AngleSharp.DOM.Html
{
public sealed class HTMLImageElement : HTMLElement
{
public const string Tag = "img";
public const string FalseTag = "image";
private uint imageWidth;
private uint imageHeight;
private bool loaded;
public string Src {
get {
return GetAttribute("src");
}
set {
SetAttribute("src", value);
}
}
public string Alt {
get {
return GetAttribute("alt");
}
set {
SetAttribute("alt", value);
}
}
public string CrossOrigin {
get {
return GetAttribute("crossorigin");
}
set {
SetAttribute("crossorigin", value);
}
}
public string UseMap {
get {
return GetAttribute("usemap");
}
set {
SetAttribute("usemap", value);
}
}
public uint Width {
get {
return Element.ToInteger(GetAttribute("width"), imageWidth);
}
set {
SetAttribute("width", value.ToString());
}
}
public uint Height {
get {
return Element.ToInteger(GetAttribute("height"), imageHeight);
}
set {
SetAttribute("height", value.ToString());
}
}
public uint NaturalWidth => imageWidth;
public uint NaturalHeight => imageHeight;
public bool Complete => loaded;
public bool IsMap {
get {
return GetAttribute("ismap") != null;
}
set {
SetAttribute("ismap", value ? string.Empty : null);
}
}
protected internal override bool IsSpecial => true;
public HTMLImageElement()
{
loaded = true;
_name = "img";
}
}
}