77 lines
2.3 KiB
Swift
77 lines
2.3 KiB
Swift
//
|
|
// Output.swift
|
|
// HTMLStandard
|
|
//
|
|
// Generated on 09/23/2025.
|
|
// THIS FILE IS GENERATED. DO NOT EDIT.
|
|
//
|
|
import Foundation
|
|
|
|
/// <output> Calculated output value
|
|
public class Output : HTMLNode, IFlow, IFormAssociated, ILabelable, IListed, IPalpable, IPhrasing, IResettable {
|
|
|
|
/// Specifies controls from which the output was calculated. Unordered set of unique space-separated tokens, case-sensitive, consisting of IDs. The actual rules are more complicated than indicated.
|
|
public var for_:[String] = []
|
|
|
|
/// Associates the element with a form element. ID. The actual rules are more complicated than indicated.
|
|
public var form:String? = nil
|
|
|
|
/// Name of the element to use for form submission and in the form.elements API. Text. The actual rules are more complicated than indicated.
|
|
public var name:String? = nil
|
|
|
|
|
|
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
|
var globalAttr = GlobalAttributesBuilder()
|
|
for (key, attValue) in attributes {
|
|
switch (key) {
|
|
case "for":
|
|
for_ = try String.parseList(attValue, " ")
|
|
continue
|
|
case "form":
|
|
form = attValue
|
|
continue
|
|
case "name":
|
|
name = 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: "output", 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()
|
|
result += " for='\(for_.toStringList(" "))'"
|
|
if let form = form {
|
|
result += " form='\(form)'"
|
|
}
|
|
if let name = name {
|
|
result += " name='\(name)'"
|
|
}
|
|
|
|
|
|
return result
|
|
}
|
|
|
|
override var nodeName: String {
|
|
return "output"
|
|
}
|
|
|
|
override var isVoidElement: Bool {
|
|
return false
|
|
}
|
|
} |