//
// Base.swift
// HTMLStandard
//
// Generated on 09/23/2025.
// THIS FILE IS GENERATED. DO NOT EDIT.
//
import Foundation
/// Base URL and default target browsing context for hyperlinks and forms
public class Base : HTMLNode, IMetaData {
/// Document base URL. Valid URL potentially surrounded by spaces.
public var href:URL? = nil
/// Default browsing context for hyperlink navigation and form submission. Valid browsing context name or keyword.
public var target:String? = nil
public init(_ attributes:[String:String], _ parser:XMLParser? = nil) throws {
var globalAttr = GlobalAttributesBuilder()
for (key, attValue) in attributes {
switch (key) {
case "href":
href = try URL(expect: attValue)
continue
case "target":
target = attValue
continue
default: break
}
if globalAttr.trySetGlobalAttribute(key, attValue) {
continue
}
continue
}
super.init(globalAttr)
}
public override func renderAttributes() -> String {
var result = super.renderAttributes()
if let href = href {
result += " href='\(href.absoluteString)'"
}
if let target = target {
result += " target='\(target)'"
}
return result
}
override var nodeName: String {
return "base"
}
override var isVoidElement: Bool {
return true
}
}