Skip to content

Commit 2ce3194

Browse files
authored
Prevent empty style attribute string (#14)
Prevent <tag style=""></tag>
1 parent 9e6389f commit 2ce3194

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/SwiftHtml/Attributes/Global.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ public extension Tag {
173173

174174
/// Specifies an inline CSS style for an element
175175
func style(_ value: String) -> Self {
176-
attribute("style", value)
176+
guard !value.isEmpty else { return self }
177+
return attribute("style", value)
177178
}
178179

179180
/// Specifies the tabbing order of an element

0 commit comments

Comments
 (0)