html
html copied to clipboard
Value vs Attribute "value"
There is difference between the Html generated by Html.Attributes.attribute "value" ""
and Html.Attributes.value ""
that leads to some unexpected behaviour.
To illustrate the issue, here is an example select element with 2 options.
https://ellie-app.com/8xvjpZt6NwSa1
select
[ onInput Pick ]
[ option [ value "" ] [ text "Empty Value" ]
, option [ selected True, attribute "value" "" ] [ text "Empty Attribute Value" ]
]
Switching options 3 times produces the following inconsistent messages.
Pick "Empty Value"
Pick ""
Pick ""
This seems to be more general than just Html.Attributes.value.
Html.Attributes.selected
is broken, too:
For the following code:
main =
Html.div []
[ Html.select []
[ Html.option [ Attr.selected True ] [ Html.text "Value A" ]
, Html.option [] [ Html.text "Value B" ]
]
]
No selected
value is added to the DOM.
Ellie: https://ellie-app.com/h4rZFfTtWj3a1