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

Svg.Attributes.style not consistent with Html.Attributes.style #21

Open
jhrcek opened this issue Aug 11, 2017 · 1 comment
Open

Svg.Attributes.style not consistent with Html.Attributes.style #21

jhrcek opened this issue Aug 11, 2017 · 1 comment

Comments

@jhrcek
Copy link

jhrcek commented Aug 11, 2017

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.

@process-bot
Copy link

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

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

2 participants