61 lines
1.4 KiB
Swift
61 lines
1.4 KiB
Swift
//
|
|
// Dialog.swift
|
|
// HTMLStandard
|
|
//
|
|
// Generated on 09/23/2025.
|
|
// THIS FILE IS GENERATED. DO NOT EDIT.
|
|
//
|
|
import Foundation
|
|
|
|
/// <dialog> Dialog box or window
|
|
public class Dialog : HTMLNode, IFlow, ISectioningRoot {
|
|
|
|
/// Whether the dialog box is showing.
|
|
public var open:Bool = false
|
|
|
|
|
|
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
|
var globalAttr = GlobalAttributesBuilder()
|
|
for (key, attValue) in attributes {
|
|
switch (key) {
|
|
case "open":
|
|
open = true
|
|
continue
|
|
|
|
default: break
|
|
}
|
|
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
|
continue
|
|
}
|
|
throw AppError("Unexpected attribute: \(key)")
|
|
}
|
|
var allItems:[HTMLNode] = []
|
|
while let obj = try parser?.readObject(endTag: "dialog", xmlToHtmlMapper) {
|
|
allItems.append(obj)
|
|
}
|
|
super.init(globalAttr, allItems)
|
|
}
|
|
|
|
|
|
public func addChild(_ someElement:IFlow) {
|
|
children.append(someElement)
|
|
}
|
|
|
|
public override func renderAttributes() -> String {
|
|
var result = super.renderAttributes()
|
|
if open {
|
|
result += " open"
|
|
}
|
|
|
|
|
|
return result
|
|
}
|
|
|
|
override var nodeName: String {
|
|
return "dialog"
|
|
}
|
|
|
|
override var isVoidElement: Bool {
|
|
return false
|
|
}
|
|
} |