Files
HtmlRW/Sources/BindingGenerator/Generated/Elements/Object.swift

112 lines
3.2 KiB
Swift

//
// Object.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// <object> Image, nested browsing context, or plugin
public class Object : HTMLNode, IEmbedded, IFlow, IFormAssociated, IInteractive, IListed, IPalpable, IPhrasing, ISubmittable {
/// Address of the resource. Valid non-empty URL potentially surrounded by spaces.
public var data:URL? = nil
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
public var form:String? = nil
/// 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
/// Type of embedded resource. Valid MIME type string.
public var type:String? = nil
/// Name of image map to use. Valid hash-name reference. The actual rules are more complicated than indicated.
public var usemap: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 "data":
data = try URL(expect: attValue)
continue
case "form":
form = attValue
continue
case "height":
height = UInt(attValue)
continue
case "name":
name = attValue
continue
case "type":
type = attValue
continue
case "usemap":
usemap = 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: "object", xmlToHtmlMapper) {
allItems.append(obj)
}
super.init(globalAttr, allItems)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let data = data {
result += " data='\(data.absoluteString)'"
}
if let form = form {
result += " form='\(form)'"
}
if let height = height {
result += " height='\(height)'"
}
if let name = name {
result += " name='\(name)'"
}
if let type = type {
result += " type='\(type)'"
}
if let usemap = usemap {
result += " usemap='\(usemap)'"
}
if let width = width {
result += " width='\(width)'"
}
return result
}
override var nodeName: String {
return "object"
}
override var isVoidElement: Bool {
return false
}
}