Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3484,13 +3484,21 @@ extension StyleAttribute where Self: ContentNode {
internal func mutate(style value: String) -> Self {
return self.mutate(key: "style", value: value)
}

internal func mutate(style value: TaintedString) -> Self {
return self.mutate(key: "style", value: value)
}
}

extension StyleAttribute where Self: EmptyNode {

internal func mutate(style value: String) -> Self {
return self.mutate(key: "style", value: value)
}

internal func mutate(style value: TaintedString) -> Self {
return self.mutate(key: "style", value: value)
}
}

/// A type that provides the `tabIndex` modifier.
Expand Down
12 changes: 6 additions & 6 deletions Sources/HTMLKit/Abstraction/Elements/BasicElements.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ extension Html: GlobalAttributes, GlobalEventAttributes {
}

public func style(_ value: String) -> Html {
return mutate(style: value)
return mutate(style: TaintedString(value, as: .css(.attribute)))
}

public func tabIndex(_ value: Int) -> Html {
Expand Down Expand Up @@ -257,23 +257,23 @@ extension Html: GlobalAttributes, GlobalEventAttributes {
}

public func on(event: Events.Drag, _ value: String) -> Html {
return mutate(key: event.rawValue, value: value)
return mutate(key: event.rawValue, value: TaintedString(value, as: .js(.attribute)))
}

public func on(event: Events.Clipboard, _ value: String) -> Html {
return mutate(key: event.rawValue, value: value)
return mutate(key: event.rawValue, value: TaintedString(value, as: .js(.attribute)))
}

public func on(event: Events.Keyboard, _ value: String) -> Html {
return mutate(key: event.rawValue, value: value)
return mutate(key: event.rawValue, value: TaintedString(value, as: .js(.attribute)))
}

public func on(event: Events.Mouse, _ value: String) -> Html {
return mutate(key: event.rawValue, value: value)
return mutate(key: event.rawValue, value: TaintedString(value, as: .js(.attribute)))
}

public func on(event: Events.Wheel, _ value: String) -> Html {
return mutate(key: event.rawValue, value: value)
return mutate(key: event.rawValue, value: TaintedString(value, as: .js(.attribute)))
}
}

Expand Down
Loading