// // Canvas.swift // HTMLStandard // // Generated on 09/23/2025. // THIS FILE IS GENERATED. DO NOT EDIT. // import Foundation /// Scriptable bitmap canvas public class Canvas : HTMLNode, IEmbedded, IFlow, IPalpable, IPhrasing { /// Vertical dimension. Valid non-negative integer. public var height:UInt? = 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 "height": height = UInt(attValue) continue case "width": width = UInt(attValue) continue default: break } if globalAttr.trySetGlobalAttribute(key, attValue) { continue } throw AppError("Unexpected attribute: \(key)") } var allItems:[HTMLNode] = [] while let obj = try parser?.readObject(endTag: "canvas", xmlToHtmlMapper) { allItems.append(obj) } super.init(globalAttr, allItems) } public override func renderAttributes() -> String { var result = super.renderAttributes() if let height = height { result += " height='\(height)'" } if let width = width { result += " width='\(width)'" } return result } override var nodeName: String { return "canvas" } override var isVoidElement: Bool { return false } }