Initial Commit
This commit is contained in:
115
Sources/HRW/GenHTML/Elements/Select.swift
Normal file
115
Sources/HRW/GenHTML/Elements/Select.swift
Normal file
@@ -0,0 +1,115 @@
|
||||
//
|
||||
// Select.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <select> List box control
|
||||
public class Select : HTMLNode, IFlow, IFormAssociated, IInteractive, ILabelable, IListed, IPalpable, IPhrasing, IResettable, ISubmittable {
|
||||
|
||||
/// Hint for form autofill feature. Autofill field name and related tokens. The actual rules are more complicated than indicated.
|
||||
public var autocomplete:String? = nil
|
||||
|
||||
/// Whether the form control is 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
|
||||
|
||||
/// Whether to allow multiple values.
|
||||
public var multiple:Bool = false
|
||||
|
||||
/// 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
|
||||
|
||||
/// Whether the control is required for form submission.
|
||||
public var required:Bool = false
|
||||
|
||||
/// Size of the control. Valid non-negative integer greater than zero.
|
||||
public var size:UInt? = nil
|
||||
|
||||
|
||||
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
|
||||
var globalAttr = GlobalAttributesBuilder()
|
||||
for (key, attValue) in attributes {
|
||||
switch (key) {
|
||||
case "autocomplete":
|
||||
autocomplete = attValue
|
||||
continue
|
||||
case "disabled":
|
||||
disabled = true
|
||||
continue
|
||||
case "form":
|
||||
form = attValue
|
||||
continue
|
||||
case "multiple":
|
||||
multiple = true
|
||||
continue
|
||||
case "name":
|
||||
name = attValue
|
||||
continue
|
||||
case "required":
|
||||
required = true
|
||||
continue
|
||||
case "size":
|
||||
size = 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: "select", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public func addChild(_ someElement:IScriptSupporting) {
|
||||
children.append(someElement)
|
||||
}
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if let autocomplete = autocomplete {
|
||||
result += " autocomplete='\(autocomplete)'"
|
||||
}
|
||||
if disabled {
|
||||
result += " disabled"
|
||||
}
|
||||
if let form = form {
|
||||
result += " form='\(form)'"
|
||||
}
|
||||
if multiple {
|
||||
result += " multiple"
|
||||
}
|
||||
if let name = name {
|
||||
result += " name='\(name)'"
|
||||
}
|
||||
if required {
|
||||
result += " required"
|
||||
}
|
||||
if let size = size {
|
||||
result += " size='\(size)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "select"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user