// // Iframe.swift // HTMLStandard // // Generated on 09/23/2025. // THIS FILE IS GENERATED. DO NOT EDIT. // import Foundation /// Nested browsing context public class Iframe : HTMLNode, IEmbedded, IFlow, IInteractive, IPalpable, IPhrasing { /// Feature policy to be applied to the iframe's contents. Serialized feature policy. public var allow:String? = nil /// Whether to allow the iframe's contents to use requestFullscreen(). public var allowfullscreen:Bool = false /// Whether the iframe's contents are allowed to use the PaymentRequest interface to make payment requests. public var allowpaymentrequest:Bool = false /// Vertical dimension. Valid non-negative integer. public var height:UInt? = nil /// Name of nested browsing context. Valid browsing context name or keyword. public var name:String? = nil /// Referrer policy for fetches initiated by the element. Referrer policy. public var referrerpolicy:ReferrerPolicy? = nil /// Security rules for nested content. Unordered set of unique space-separated tokens, ASCII case-insensitive, consisting of "allow-forms", "allow-modals", "allow-orientation-lock", "allow-pointer-lock", "allow-popups", "allow-popups-to-escape-sandbox", "allow-presentation", "allow-same-origin", "allow-scripts" and "allow-top-navigation". public var sandbox:Set = Set() /// Address of the resource. Valid non-empty URL potentially surrounded by spaces. public var src:URL? = nil /// A document to render in the iframe. The source of an iframe srcdoc document. The actual rules are more complicated than indicated. public var srcdoc:String? = nil /// Horizontal dimension. Valid non-negative integer. public var width:UInt? = nil public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws { var globalAttr = GlobalAttributesBuilder() for (key, attValue) in attributes { switch (key) { case "allow": allow = attValue continue case "allowfullscreen": allowfullscreen = true continue case "allowpaymentrequest": allowpaymentrequest = true continue case "height": height = UInt(attValue) continue case "name": name = attValue continue case "referrerpolicy": referrerpolicy = try ReferrerPolicy(expect: attValue) continue case "sandbox": sandbox = Set() continue case "src": src = try URL(expect: attValue) continue case "srcdoc": srcdoc = attValue continue case "width": width = UInt(attValue) continue default: break } if globalAttr.trySetGlobalAttribute(key, attValue) { continue } continue } var allItems:[HTMLNode] = [] while let obj = try parser?.readObject(endTag: "iframe", xmlToHtmlMapper) { allItems.append(obj) } super.init(globalAttr, allItems) } public override func renderAttributes() -> String { var result = super.renderAttributes() if let allow = allow { result += " allow='\(allow)'" } if allowfullscreen { result += " allowfullscreen" } if allowpaymentrequest { result += " allowpaymentrequest" } if let height = height { result += " height='\(height)'" } if let name = name { result += " name='\(name)'" } if let referrerpolicy = referrerpolicy { result += " referrerpolicy='\(referrerpolicy.rawValue)'" } result += " sandbox='\(sandbox.toStringList(" "))'" if let src = src { result += " src='\(src.absoluteString)'" } if let srcdoc = srcdoc { result += " srcdoc='\(srcdoc)'" } if let width = width { result += " width='\(width)'" } return result } override var nodeName: String { return "iframe" } override var isVoidElement: Bool { return false } }