Moved BindingGenerator from gen html project. It makes more sense here.
This commit is contained in:
84
Sources/BindingGenerator/Generated/Elements/Option.swift
Normal file
84
Sources/BindingGenerator/Generated/Elements/Option.swift
Normal file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// Option.swift
|
||||
// HTMLStandard
|
||||
//
|
||||
// Generated on 09/23/2025.
|
||||
// THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
/// <option> Option in a list box or combo box control
|
||||
public class OptionHtml : HTMLNode {
|
||||
|
||||
/// Whether the form control is disabled.
|
||||
public var disabled:Bool = false
|
||||
|
||||
/// User-visible label.
|
||||
public var label:String? = nil
|
||||
|
||||
/// Whether the option is selected by default.
|
||||
public var selected:Bool = false
|
||||
|
||||
/// Value to be used for form submission.
|
||||
public var value: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 "label":
|
||||
label = attValue
|
||||
continue
|
||||
case "selected":
|
||||
selected = true
|
||||
continue
|
||||
case "value":
|
||||
value = attValue
|
||||
continue
|
||||
|
||||
default: break
|
||||
}
|
||||
if globalAttr.trySetGlobalAttribute(key, attValue) {
|
||||
continue
|
||||
}
|
||||
continue
|
||||
}
|
||||
var allItems:[HTMLNode] = []
|
||||
while let obj = try parser?.readObject(endTag: "option", xmlToHtmlMapper) {
|
||||
allItems.append(obj)
|
||||
}
|
||||
super.init(globalAttr, allItems)
|
||||
}
|
||||
|
||||
|
||||
public override func renderAttributes() -> String {
|
||||
var result = super.renderAttributes()
|
||||
if disabled {
|
||||
result += " disabled"
|
||||
}
|
||||
if let label = label {
|
||||
result += " label='\(label)'"
|
||||
}
|
||||
if selected {
|
||||
result += " selected"
|
||||
}
|
||||
if let value = value {
|
||||
result += " value='\(value)'"
|
||||
}
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
override var nodeName: String {
|
||||
return "option"
|
||||
}
|
||||
|
||||
override var isVoidElement: Bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user