-
Notifications
You must be signed in to change notification settings - Fork 79
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
Empty string as attribute name causes exception. #141
Comments
Caused by d32f9b4 Probably fix would be to also check if attribute key is not empty, since that is not allowed. |
Here is @Carlsson87's sscce: module Main exposing (main)
import Html
import Html.Attributes
main =
Html.div [ Html.Attributes.attribute "" "" ] [] |
To be extra specific. The problem seems to occur when the key is an empty string. The value being an empty string does not cause any problems for me. |
Why are you doing this? |
When I conditionally want to set an attribute on an element. I use the same approach with showButton : Maybe msg -> Html msg
showButton clickMsg =
Html.button
[ case clickMsg of
Just msg ->
Html.Events.onClick msg
Nothing ->
Html.Attributes.attribute "" ""
]
[ Html.text "Click here"
] I'd love to know if there is a better way. |
We use a similar pattern for conditional attributes, we have it defined as
Which seems to be valid still https://ellie-app.com/3ks2h7XJWnTa1 |
I just upgraded to version
1.0.1
and ran in to problems when usingHtml.attribute "" ""
. It didn't use to cause an exception, and now it does. Let me know if you need more info.SSCCE: https://ellie-app.com/3kjwsTXvQNTa1
The text was updated successfully, but these errors were encountered: