-
Notifications
You must be signed in to change notification settings - Fork 19
Description
There is a discrepancy in how elm-lang/html and elm-lang/svg packages work with style
attribute. This attribute is declared with different types in each package:
Html.Attributes.style : List (String, String) -> Attribute msg
versus
Svg.Attributes.style : String -> Attribute msg
This is not problem per se. What I find problematic though is that when multiple style
attributes are present the list of attributes of one element, in Html the styles are combined, whereas in Svg the "last one wins". See the following code fragment on ellie for illustration of the issue.
This typically causes problems when you have reusable view function and want to provide additional attributes like so:
myWidget : List (Attribute msg) -> Svg msg
myWidget additionalAttributes = ...
Wouldn't it make sense to unify this and have Svg.Attributes.style
have the same type and behavior as Html.Attributes.style
?
See an example fix I had to do in a project I'm working on to work around this problem.