Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Always add Attribute xmlns to SVG nodes #11

Open
johannesvollmer opened this issue Oct 21, 2022 · 0 comments
Open

Always add Attribute xmlns to SVG nodes #11

johannesvollmer opened this issue Oct 21, 2022 · 0 comments

Comments

@johannesvollmer
Copy link

johannesvollmer commented Oct 21, 2022

The Svg package for rendering elements automatically adds the namespace.
See https://github.com/elm/svg/blob/dfe97e8282f283f4a62b6645f633076cfd24f3f7/src/Svg.elm#L101

This package will be missing the svg namespace attribute when converted to String. I propose we always add it to any svg root node.

Maybe like this?

{-| -}
svg : List (Attribute msg) -> List (Svg msg) -> Html msg
svg attributes =
    htmlNode "svg" (xmlns svgNamespace :: attributes)

Or maybe like

{-| -}
svg : String -> String -> List (Attribute msg) -> List (Svg msg) -> Html msg
svg namespace version attributes =
    htmlNode "svg" (Attribute.xmlns namespace :: Attribute.version version :: attributes)

Alternatively, in the toString function.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant