79 lines
2.2 KiB
Swift
79 lines
2.2 KiB
Swift
//
|
|
// Fieldset.swift
|
|
// HTMLStandard
|
|
//
|
|
// Generated on 09/23/2025.
|
|
// THIS FILE IS GENERATED. DO NOT EDIT.
|
|
//
|
|
import Foundation
|
|
|
|
/// <fieldset> Group of form controls
|
|
public class Fieldset : HTMLNode, IFlow, IFormAssociated, IListed, IPalpable, ISectioningRoot {
|
|
|
|
/// Whether the descendant form controls, except any inside legend, are disabled.
|
|
public var disabled:Bool = false
|
|
|
|
/// 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 "disabled":
|
|
disabled = true
|
|
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: "fieldset", 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 disabled {
|
|
result += " disabled"
|
|
}
|
|
if let form = form {
|
|
result += " form='\(form)'"
|
|
}
|
|
if let name = name {
|
|
result += " name='\(name)'"
|
|
}
|
|
|
|
|
|
return result
|
|
}
|
|
|
|
override var nodeName: String {
|
|
return "fieldset"
|
|
}
|
|
|
|
override var isVoidElement: Bool {
|
|
return false
|
|
}
|
|
} |