add_render_attribute should treat boolean values as boolean attributes #23507
75th
started this conversation in
Feature Request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Prerequisites
What problem is your feature request going to solve? Please describe.
If you provide an a value of boolean
falseto an attribute inControls_Stack::add_render_attribute, thenget_render_attribute_stringstill prints that attribute name with no value. This is contrary to HTML's concept of a "boolean attribute", for which<img data-attribute />has a true boolean attribute ofdata-attribute, and only<img />has that attribute asfalse.Describe the solution you'd like
These lines in the
add_render_attributefunction:...should be something more like this to properly handle a boolean
false:Describe alternatives you've considered
I know that solution could have side effects on existing code, so perhaps instead some magic constant could be used to specify the value, so at least we could do something like this:
instead of this dance, which is what is currently necessary:
Additional context
No response
All reactions