8000 Support attribute extension by mattesmohr · Pull Request #211 · vapor-community/HTMLKit · GitHub
[go: up one dir, main page]

Skip to content

Support attribute extension - #211

Merged
mattesmohr merged 6 commits into
mainfrom
support-attribute-extension
Feb 5, 2026
Merged

mattesmohr merged 6 commits into
mainfrom
support-attribute-extension

Conversation

@mattesmohr
@mattesmohr mattesmohr commented Jan 26, 2026 •
Copy link
Copy Markdown
Member

This pull request addresses #182 and adds support for conditional attribute extension, by giving the user the choice of a .replacing or .combining operation, while the modifier defaults to .replacing.

Division {
}
.class("lorem")
.modify(true, use: .combining) {
   $0.class("ipsum")
}

// Renders <div class="lorem ipsum">...

Data types, which cannot meaningfully combined like Bool will automatically replaced. Open for debate, whether a String should count as a combinable type. For now, it is more about list attributes such as class, headers... I would say.

This pull request acknowledges that the value of the attributes like class, headers are actually a list, defined by its individual values plus a separator. With that in place, all information needed for a predictable combination is already available.

@mattesmohr
mattesmohr marked this pull request as ready for review February 3, 2026 18:46
@mattesmohr
mattesmohr merged commit 6345311 into main Feb 5, 2026
1 check passed
@mattesmohr
mattesmohr deleted the support-attribute-extension branch February 5, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0