Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial attributes #40

Closed
luwes opened this issue Sep 29, 2019 · 1 comment
Closed

Partial attributes #40

luwes opened this issue Sep 29, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@luwes
Copy link
Owner

luwes commented Sep 29, 2019

Research if partial attributes are possible and worth adding.

@luwes luwes added the enhancement New feature or request label Sep 29, 2019
@luwes luwes added this to the Sinuous v1.0.0 milestone Sep 29, 2019
@luwes luwes self-assigned this Sep 29, 2019
@luwes luwes removed this from the Sinuous v1.0.0 milestone Oct 5, 2019
@luwes
Copy link
Owner Author

luwes commented Oct 5, 2019

It would need to be handled somewhere in the logic of sinuous/htm.

Currently htm does support partial attributes https://github.com/developit/htm/releases/tag/2.2.0 but they are concatenated. An observable, essentially a function, and a string can't be joined like that.

The solution would be something like detect whether one part is an observable, wrap both parts in a closure.

html`<div class="margin${side}"></div>`

becomes

h('div', {
	class: () => 'margin' + side()
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant