Skip to content

Commit 77081ae

Browse files
authored
Use the correct enum in the type modifier of the script element (#205)
* Change the accepted parameter type
1 parent 5bf3348 commit 77081ae

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

Sources/HTMLKit/Abstraction/Elements/BodyElements.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21360,7 +21360,7 @@ extension Script: GlobalAttributes, GlobalEventAttributes, AsynchronouslyAttribu
2136021360
return mutate(source: value)
2136121361
}
2136221362

21363-
public func type(_ value: Values.Media) -> Script {
21363+
public func type(_ value: Values.Script) -> Script {
2136421364
return mutate(type: value.rawValue)
2136521365
}
2136621366

Sources/HTMLKit/Abstraction/Tokens/ValueTokens.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,4 +2231,26 @@ public enum Values {
22312231
/// Permits the content to navigate its top-level browsing context, but only if initiated by user.
22322232
case allowTopNavigationByUserActivation = "allow-top-navigation-by-user-activation"
22332233
}
2234+
2235+
/// An enumeration of script types.
2236+
///
2237+
/// ```swift
2238+
/// Script {
2239+
/// }
2240+
/// .type(.module)
2241+
/// ```
2242+
public enum Script: String {
2243+
2244+
/// Indicates the script is used as importmap.
2245+
case importMap = "importmap"
2246+
2247+
/// Indicates the script is used as module.
2248+
case module
2249+
2250+
/// Indicates the script defines speculation rules.
2251+
case speculationRules = "speculationrules"
2252+
2253+
/// Indicates the script contains json data.
2254+
case data = "application/json"
2255+
}
22342256
}

0 commit comments

Comments
 (0)