Skip to content

Commit 9c16e39

Browse files
committed
Input placeholder optional
1 parent 2afe6ba commit 9c16e39

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/SwiftHtml/Html/Tags/Input.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,10 @@ public extension Input {
188188
}
189189

190190
/// Specifies a short hint that describes the expected value of an `<input>` element
191-
func placeholder(_ value: String) -> Self {
192-
node.upsert(Attribute(key: "placeholder", value: value))
191+
func placeholder(_ value: String?) -> Self {
192+
if let value = value {
193+
node.upsert(Attribute(key: "placeholder", value: value))
194+
}
193195
return self
194196
}
195197

0 commit comments

Comments
 (0)