HtmlMetaElement
sealed class HtmlMetaElement : HtmlElement, IHtmlMetaElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IGlobalEventHandlers
Represents the HTML meta element.
using AngleSharp.Dom.Css;
using AngleSharp.Dom.Events;
using AngleSharp.Extensions;
using AngleSharp.Html;
using AngleSharp.Network;
using System.Text;
namespace AngleSharp.Dom.Html
{
internal sealed class HtmlMetaElement : HtmlElement, IHtmlMetaElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IGlobalEventHandlers
{
public string Content {
get {
return this.GetOwnAttribute(AttributeNames.Content);
}
set {
this.SetOwnAttribute(AttributeNames.Content, value, false);
}
}
public string Charset {
get {
return this.GetOwnAttribute(AttributeNames.Charset);
}
set {
this.SetOwnAttribute(AttributeNames.Charset, value, false);
}
}
public string HttpEquivalent {
get {
return this.GetOwnAttribute(AttributeNames.HttpEquiv);
}
set {
this.SetOwnAttribute(AttributeNames.HttpEquiv, value, false);
}
}
public string Scheme {
get {
return this.GetOwnAttribute(AttributeNames.Scheme);
}
set {
this.SetOwnAttribute(AttributeNames.Scheme, value, false);
}
}
public string Name {
get {
return this.GetOwnAttribute(AttributeNames.Name);
}
set {
this.SetOwnAttribute(AttributeNames.Name, value, false);
}
}
public HtmlMetaElement(Document owner, string prefix = null)
: base(owner, TagNames.Meta, prefix, NodeFlags.SelfClosing | NodeFlags.Special)
{
}
public Encoding GetEncoding()
{
string charset = Charset;
if (charset != null) {
charset = charset.Trim();
if (TextEncoding.IsSupported(charset))
return TextEncoding.Resolve(charset);
}
string httpEquivalent = HttpEquivalent;
if (httpEquivalent == null || !httpEquivalent.Isi(HeaderNames.ContentType))
return null;
return TextEncoding.Parse(Content ?? string.Empty);
}
}
}