-
-
Save anonymous/6c0bd25ee883f945e1c6365316fb07d3 to your computer and use it in GitHub Desktop.
xlink:href breaking the elm virtual dom diffing?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Html exposing (Html) | |
import Svg exposing (..) | |
import Svg.Attributes exposing (..) | |
import VirtualDom exposing (attributeNS) | |
import AnimationFrame | |
import Time exposing (Time) | |
main = | |
Html.program | |
{ init = init | |
, view = view | |
, update = update | |
, subscriptions = subscriptions | |
} | |
-- MODEL | |
type alias Model = Time | |
init : (Model, Cmd Msg) | |
init = | |
(0, Cmd.none) | |
-- UPDATE | |
type Msg | |
= Tick Time | |
update : Msg -> Model -> (Model, Cmd Msg) | |
update msg model = | |
case msg of | |
Tick newTime -> | |
(0, Cmd.none) | |
-- SUBSCRIPTIONS | |
subscriptions : Model -> Sub Msg | |
subscriptions model = | |
AnimationFrame.times Tick | |
-- VIEW | |
view : Model -> Html Msg | |
view model = | |
let | |
justCirc = [ circle [cx "50", cy "50", r "40", strokeWidth "8", stroke "red", fill "red"] [] ] | |
symAndUse = | |
[ symbol [id "sym01"] justCirc | |
, use [xlinkHref "#sym01", x "0", y "0", width "100", height "100"] [] | |
] | |
in | |
svg [ viewBox "0 0 200 200", width "600px" ] | |
--justCirc | |
symAndUse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment