Skip to content

Comments

Added ability to set attributes on body in HTMLDocument types#94

Merged
sliemeobn merged 3 commits intoelementary-swift:mainfrom
digitalloophole:main
Feb 18, 2026
Merged

Added ability to set attributes on body in HTMLDocument types#94
sliemeobn merged 3 commits intoelementary-swift:mainfrom
digitalloophole:main

Conversation

@cgriffin
Copy link
Contributor

Added ability to set attributes on the body tag.
Added tests.

// which would cause confusing issues when adopters provide a property of a non-optional type.
private let defaultUndefinedLanguage = ""
private let defaultUndefinedDirection = ""
private let defaultUndefinedAttributes: [HTMLAttribute<HTMLTag.body>] = []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this here (since we never conditionally check for it)

/// The default value for the `dir` property is an empty string and will not be rendered in the HTML.
var dir: HTMLAttributeValue.Direction { .init(value: defaultUndefinedDirection) }
/// The default value for the `bodyAttribute` property is an empty array.
var bodyAttributes: [HTMLAttribute<HTMLTag.body>] { defaultUndefinedAttributes }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be cleaner to "just" return an empty array here

Copy link
Collaborator

@sliemeobn sliemeobn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall lgtm, thanks!

I would prefer to not use the "empty value constant" for now reason

@sliemeobn sliemeobn changed the title Added ability to set attributes on the body tag. Added ability to set attributes on body in HTMLDocument types Feb 18, 2026
@sliemeobn sliemeobn changed the title Added ability to set attributes on body in HTMLDocument types Added ability to set attributes on body in HTMLDocument types Feb 18, 2026
@sliemeobn sliemeobn merged commit ca09461 into elementary-swift:main Feb 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants