We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2755f57 commit d09e6d6Copy full SHA for d09e6d6
Sources/HTMLKitUtilities/HTMLKitUtilities.swift
@@ -64,6 +64,7 @@ public extension String {
64
}
65
/// Escapes all occurrences of source-breaking HTML attribute characters
66
mutating func escapeHTMLAttributes() {
67
+ self.replace("\\\"", with: """)
68
self.replace("\"", with: """)
69
self.replace("'", with: "'")
70
Tests/HTMLKitTests/ElementTests.swift
@@ -36,6 +36,9 @@ struct ElementTests {
36
37
string = #html(div(attributes: [.title("<p>")], "<p></p>"))
38
#expect(string == expected_result)
39
+
40
+ string = #html(p("What's 9 + 10? \"21\"!"))
41
+ #expect(string == "<p>What's 9 + 10? "21"!</p>")
42
43
44
0 commit comments