HtmlIFrameElement
sealed class HtmlIFrameElement : HtmlFrameElementBase, IHtmlInlineFrameElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IGlobalEventHandlers, ILoadableElement
Represents the HTML iframe element.
using AngleSharp.Dom.Collections;
using AngleSharp.Dom.Css;
using AngleSharp.Dom.Events;
using AngleSharp.Extensions;
using AngleSharp.Html;
namespace AngleSharp.Dom.Html
{
internal sealed class HtmlIFrameElement : HtmlFrameElementBase, IHtmlInlineFrameElement, IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IElementCssInlineStyle, IGlobalEventHandlers, ILoadableElement
{
private SettableTokenList _sandbox;
public Alignment Align {
get {
return this.GetOwnAttribute(AttributeNames.Align).ToEnum(Alignment.Bottom);
}
set {
this.SetOwnAttribute(AttributeNames.Align, value.ToString(), false);
}
}
public string ContentHtml {
get {
return this.GetOwnAttribute(AttributeNames.SrcDoc);
}
set {
this.SetOwnAttribute(AttributeNames.SrcDoc, value, false);
}
}
public ISettableTokenList Sandbox {
get {
if (_sandbox == null) {
_sandbox = new SettableTokenList(this.GetOwnAttribute(AttributeNames.Sandbox));
_sandbox.Changed += delegate(string value) {
UpdateAttribute(AttributeNames.Sandbox, value);
};
}
return _sandbox;
}
}
public bool IsSeamless {
get {
return this.HasOwnAttribute(AttributeNames.SrcDoc);
}
set {
this.SetOwnAttribute(AttributeNames.SrcDoc, value ? string.Empty : null, false);
}
}
public bool IsFullscreenAllowed {
get {
return this.HasOwnAttribute(AttributeNames.AllowFullscreen);
}
set {
this.SetOwnAttribute(AttributeNames.AllowFullscreen, value ? string.Empty : null, false);
}
}
public IWindow ContentWindow => base.NestedContext.Current;
static HtmlIFrameElement()
{
Element.RegisterCallback(AttributeNames.Sandbox, delegate(HtmlIFrameElement element, string value) {
element.TryUpdate(element._sandbox, value);
});
Element.RegisterCallback(AttributeNames.SrcDoc, delegate(HtmlIFrameElement element, string value) {
element.UpdateSource();
});
}
public HtmlIFrameElement(Document owner, string prefix = null)
: base(owner, TagNames.Iframe, prefix, NodeFlags.LiteralText)
{
}
internal override string GetContentHtml()
{
return ContentHtml;
}
internal override void SetupElement()
{
base.SetupElement();
if (this.GetOwnAttribute(AttributeNames.SrcDoc) != null)
UpdateSource();
}
}
}