70 lines
1.8 KiB
Swift
70 lines
1.8 KiB
Swift
//
|
|
// Progress.swift
|
|
// HTMLStandard
|
|
//
|
|
// Generated on 09/23/2025.
|
|
// THIS FILE IS GENERATED. DO NOT EDIT.
|
|
//
|
|
import Foundation
|
|
|
|
/// <progress> Progress bar
|
|
public class Progress : HTMLNode, IFlow, ILabelable, IPalpable, IPhrasing {
|
|
|
|
/// Upper bound of range. Valid floating-point number. The actual rules are more complicated than indicated.
|
|
public var max:Float? = nil
|
|
|
|
/// Current value of the element. Valid floating-point number.
|
|
public var value:Float? = nil
|
|
|
|
|
|
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
|
var globalAttr = GlobalAttributesBuilder()
|
|
for (key, attValue) in attributes {
|
|
switch (key) {
|
|
case "max":
|
|
max = Float(attValue)
|
|
continue
|
|
case "value":
|
|
value = Float(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: "progress", xmlToHtmlMapper) {
|
|
allItems.append(obj)
|
|
}
|
|
super.init(globalAttr, allItems)
|
|
}
|
|
|
|
|
|
public func addChild(_ someElement:IPhrasing) {
|
|
children.append(someElement)
|
|
}
|
|
|
|
public override func renderAttributes() -> String {
|
|
var result = super.renderAttributes()
|
|
if let max = max {
|
|
result += " max='\(max)'"
|
|
}
|
|
if let value = value {
|
|
result += " value='\(value)'"
|
|
}
|
|
|
|
|
|
return result
|
|
}
|
|
|
|
override var nodeName: String {
|
|
return "progress"
|
|
}
|
|
|
|
override var isVoidElement: Bool {
|
|
return false
|
|
}
|
|
} |