AngleSharp by AngleSharp

<PackageReference Include="AngleSharp" Version="0.9.5" />

.NET API 1,244,160 bytes

 HtmlObjectElement

Represents the HTML object element.
using AngleSharp.Dom.Css; using AngleSharp.Extensions; using AngleSharp.Html; using AngleSharp.Network; using AngleSharp.Network.RequestProcessors; namespace AngleSharp.Dom.Html { internal sealed class HtmlObjectElement : HtmlFormControlElement, IHtmlObjectElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IValidation, ILoadableElement { private readonly ObjectRequestProcessor _request; public IDownload CurrentDownload { get { if (_request == null) return null; return _request.Download; } } public string Source { get { return this.GetUrlAttribute(AttributeNames.Data); } set { this.SetOwnAttribute(AttributeNames.Data, value); } } public string Type { get { return this.GetOwnAttribute(AttributeNames.Type); } set { this.SetOwnAttribute(AttributeNames.Type, value); } } public bool TypeMustMatch { get { return this.HasOwnAttribute(AttributeNames.TypeMustMatch); } set { this.SetOwnAttribute(AttributeNames.TypeMustMatch, value ? string.Empty : null); } } public string UseMap { get { return this.GetOwnAttribute(AttributeNames.UseMap); } set { this.SetOwnAttribute(AttributeNames.UseMap, value); } } public int DisplayWidth { get { return this.GetOwnAttribute(AttributeNames.Width).ToInteger(OriginalWidth); } set { this.SetOwnAttribute(AttributeNames.Width, value.ToString()); } } public int DisplayHeight { get { return this.GetOwnAttribute(AttributeNames.Height).ToInteger(OriginalHeight); } set { this.SetOwnAttribute(AttributeNames.Height, value.ToString()); } } public int OriginalWidth { get { if (_request == null) return 0; return _request.Width; } } public int OriginalHeight { get { if (_request == null) return 0; return _request.Height; } } public IDocument ContentDocument => null; public IWindow ContentWindow => null; public HtmlObjectElement(Document owner, string prefix = null) : base(owner, TagNames.Object, prefix, NodeFlags.Scoped) { _request = ObjectRequestProcessor.Create(this); } protected override bool CanBeValidated() { return false; } internal override void SetupElement() { base.SetupElement(); string ownAttribute = this.GetOwnAttribute(AttributeNames.Data); RegisterAttributeObserver(AttributeNames.Data, UpdateSource); if (ownAttribute != null) UpdateSource(ownAttribute); } private void UpdateSource(string value) { Url url = new Url(Source); this.Process(_request, url); } } }