Skip to content

Commit 96c9b88

Browse files
disable type-safe CSS support (needs way more work to be fully functional)
1 parent ba71d46 commit 96c9b88

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

Sources/HTMLAttributes/HTMLAttribute.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ public enum HTMLAttribute : HTMLInitializable {
5050
case slot(String? = nil)
5151
case spellcheck(Extra.spellcheck? = nil)
5252

53-
#if canImport(CSS)
53+
/*#if canImport(CSS)
5454
case style([CSSStyle]? = nil)
55-
#else
55+
#else*/
5656
case style(String? = nil)
57-
#endif
57+
//#endif
5858

5959
case tabindex(Int? = nil)
6060
case title(String? = nil)
@@ -169,11 +169,11 @@ public enum HTMLAttribute : HTMLInitializable {
169169
case .slot(let value): return value
170170
case .spellcheck(let value): return value?.rawValue
171171

172-
#if canImport(CSS)
172+
/*#if canImport(CSS)
173173
case .style(let value): return value?.compactMap({ $0.htmlValue(encoding: encoding, forMacro: forMacro) }).joined(separator: ";")
174-
#else
174+
#else*/
175175
case .style(let value): return value
176-
#endif
176+
//#endif
177177

178178
case .tabindex(let value): return value?.description
179179
case .title(let value): return value

Sources/HTMLKitParse/extensions/html/HTMLAttributes.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ extension HTMLAttribute : HTMLParsable {
5252
case "slot": self = .slot(string())
5353
case "spellcheck": self = .spellcheck(enumeration())
5454

55-
#if canImport(CSS)
55+
/*#if canImport(CSS)
5656
case "style": self = .style(context.arrayEnumeration())
57-
#endif
57+
#else*/
58+
case "style": self = .style(context.string())
59+
//#endif
5860

5961
case "tabindex": self = .tabindex(context.int())
6062
case "title": self = .title(string())

Tests/HTMLKitTests/CSSTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ struct CSSTests {
1414

1515
@Test func cssAttribute() {
1616
let expected:String = "<div style=\"white-space:normal\"></div>"
17-
let result:String = #html(div(attributes: [.style([.whiteSpace(.normal)])]))
17+
//let result:String = #html(div(attributes: [.style([.whiteSpace(.normal)])]))
18+
let result:String = #html(div(attributes: [.style("white-space:normal")]))
1819
#expect(expected == result)
1920
}
2021

0 commit comments

Comments
 (0)