Skip to content

Commit 2dd3baf

Browse files
authored
add scope attribute to th tag (#63)
* Add scope attribute * Add 'scope' to th tag directly --------- Co-authored-by: Jacob Hearst <[email protected]>
1 parent 9830c5e commit 2dd3baf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Sources/Elementary/HtmlAttributes.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,3 +656,19 @@ public extension HTMLAttribute where Tag: HTMLTrait.Attributes.placeholder {
656656
HTMLAttribute(name: "placeholder", value: value)
657657
}
658658
}
659+
660+
// scope attribute
661+
public extension HTMLAttribute where Tag == HTMLTag.th {
662+
struct Scope: Sendable, Equatable {
663+
var value: String
664+
665+
public static var col: Self { .init(value: "col") }
666+
public static var row: Self { .init(value: "row") }
667+
public static var colgroup: Self { .init(value: "colgroup") }
668+
public static var rowgroup: Self { .init(value: "rowgroup") }
669+
}
670+
671+
static func scope(_ scope: Scope) -> Self {
672+
HTMLAttribute(name: "scope", value: scope.value)
673+
}
674+
}

0 commit comments

Comments
 (0)