Skip to content

fix: render style maps in spread attributes, fixes #1523 - #1524

Open
njarrar wants to merge 1 commit into
a-h:mainfrom
njarrar:fix/spread-style-map
Open

njarrar wants to merge 1 commit into
a-h:mainfrom
njarrar:fix/spread-style-map

Conversation

@njarrar

@njarrar njarrar commented Nov 16, 2026

Copy link
Copy Markdown

Fixes #1523

Spreading templ.Attributes with a "style" key that holds a map[string]string (or map[string]templ.SafeCSSProperty, or templ.KeyValue[string, string]) rendered nothing, although style={ ... } accepts the same values. RenderAttributes now passes these types through when the attribute is a style attribute, so they are sanitized with SanitizeStyleAttributeValues, like the static style attribute. On other attributes they are still skipped.

Added tests and a line in the spread attributes docs.

This branch has not been deployed

No deployments
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.

Spreading attributes including "style"

1 participant