File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Sources/SwiftHtml/Html/Tags Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,10 @@ public final class Option: Tag {
2121
2222public extension Option {
2323 /// Specifies that an option should be disabled
24- func disabled( ) -> Self {
25- node. upsert ( Attribute ( key: " disabled " ) )
24+ func disabled( _ condition: Bool = true ) -> Self {
25+ if condition {
26+ node. upsert ( Attribute ( key: " disabled " ) )
27+ }
2628 return self
2729 }
2830
@@ -33,8 +35,10 @@ public extension Option {
3335 }
3436
3537 /// Specifies that an option should be pre-selected when the page loads
36- func selected( ) -> Self {
37- node. upsert ( Attribute ( key: " selected " ) )
38+ func selected( _ condition: Bool = true ) -> Self {
39+ if condition {
40+ node. upsert ( Attribute ( key: " selected " ) )
41+ }
3842 return self
3943 }
4044
You can’t perform that action at this time.
0 commit comments