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

html attributes helper for value-less attributes #116

Open
phantomwhale opened this issue Aug 29, 2023 · 0 comments
Open

html attributes helper for value-less attributes #116

phantomwhale opened this issue Aug 29, 2023 · 0 comments

Comments

@phantomwhale
Copy link

So I'm aware that you can do html_attributes("data-value": nil) if condition? to return "data-value" if the condition is truthy.

Is that the cleanest / only format? On reading the code, I briefly thought html_attributes("data-value") if condition? might work, but I overlooked the stringify_keys statement that means it needs to be a hash.

Would a PR to support strings, or arrays of strings, in the method be considered?

Or is this more a case of we've provided a basic clean interface to prevent too much magic producing bad HTML, so the preference is not sprinkle too much interface overloading magic in?!

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

No branches or pull requests

1 participant