AngleSharp by AngleSharp

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

.NET API 1,224,192 bytes

 HtmlBaseElement

Represents the HTML base element.
using AngleSharp.Dom.Css; using AngleSharp.Dom.Events; using AngleSharp.Extensions; using AngleSharp.Html; namespace AngleSharp.Dom.Html { internal sealed class HtmlBaseElement : HtmlElement, IHtmlBaseElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IGlobalEventHandlers { public string Href { get { return this.GetOwnAttribute(AttributeNames.Href); } set { this.SetOwnAttribute(AttributeNames.Href, value, false); } } public string Target { get { return this.GetOwnAttribute(AttributeNames.Target); } set { this.SetOwnAttribute(AttributeNames.Target, value, false); } } static HtmlBaseElement() { Element.RegisterCallback(AttributeNames.Href, delegate(HtmlBaseElement element, string value) { element.UpdateUrl(value); }); } public HtmlBaseElement(Document owner, string prefix = null) : base(owner, TagNames.Base, prefix, NodeFlags.SelfClosing | NodeFlags.Special) { } private void UpdateUrl(string url) { base.Owner.BaseUrl = new Url(base.Owner.DocumentUrl, url ?? string.Empty); } internal override void SetupElement() { base.SetupElement(); string ownAttribute = this.GetOwnAttribute(AttributeNames.Href); if (ownAttribute != null) UpdateUrl(ownAttribute); } } }