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

inconsistent behaviour rendering booleans as data attribute values #872

Open
cromega opened this issue Apr 29, 2021 · 2 comments
Open

inconsistent behaviour rendering booleans as data attribute values #872

cromega opened this issue Apr 29, 2021 · 2 comments

Comments

@cromega
Copy link

cromega commented Apr 29, 2021

Hi,

irb(main):012:0> puts Slim::Template.new { '.test data={false: false, true: true}' }.render
<div class="test" data-false="false" data-true=""></div>

Wondering if it's somehow related to rendering certain value-less attributes (eg: readonly, checked). The obvious workaround is stringifying values before passing them to the data hash but I think this behaviour is a trap.

@chriscz
Copy link
Contributor

chriscz commented May 19, 2021

Looks like the issue might be on one of these lines but I'm not entirely sure

@minad
Copy link
Member

minad commented Sep 18, 2023

Slim behaves as expected here, since boolean values get special treatment. We could add an option to Slim::Splat::Filter in order to opt out, such that splat values are simply printed in stringified form.

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

3 participants