HtmlEmbedElement
sealed class HtmlEmbedElement : HtmlElement, IHtmlEmbedElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IGlobalEventHandlers, ILoadableElement
Represents the embed element.
using AngleSharp.Dom.Css;
using AngleSharp.Dom.Events;
using AngleSharp.Extensions;
using AngleSharp.Html;
using AngleSharp.Network;
using AngleSharp.Network.RequestProcessors;
namespace AngleSharp.Dom.Html
{
internal sealed class HtmlEmbedElement : HtmlElement, IHtmlEmbedElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IGlobalEventHandlers, ILoadableElement
{
private readonly ObjectRequestProcessor _request;
public IDownload CurrentDownload => _request?.Download;
public string Source {
get {
return this.GetOwnAttribute(AttributeNames.Src);
}
set {
this.SetOwnAttribute(AttributeNames.Src, value, false);
}
}
public string Type {
get {
return this.GetOwnAttribute(AttributeNames.Type);
}
set {
this.SetOwnAttribute(AttributeNames.Type, value, false);
}
}
public string DisplayWidth {
get {
return this.GetOwnAttribute(AttributeNames.Width);
}
set {
this.SetOwnAttribute(AttributeNames.Width, value, false);
}
}
public string DisplayHeight {
get {
return this.GetOwnAttribute(AttributeNames.Height);
}
set {
this.SetOwnAttribute(AttributeNames.Height, value, false);
}
}
public HtmlEmbedElement(Document owner, string prefix = null)
: base(owner, TagNames.Embed, prefix, NodeFlags.SelfClosing | NodeFlags.Special)
{
_request = ObjectRequestProcessor.Create(this);
}
internal override void SetupElement()
{
base.SetupElement();
string ownAttribute = this.GetOwnAttribute(AttributeNames.Src);
if (ownAttribute != null)
UpdateSource(ownAttribute);
}
internal void UpdateSource(string value)
{
Url url = new Url(Source);
this.Process(_request, url);
}
}
}