Skip to content

Commit ae87fed

Browse files
authored
Merge pull request rtfeldman#561 from Confidenceman02/master
fix: Runtime exception when using css in SVG elements
2 parents 439e757 + 485e85c commit ae87fed

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

elm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@
3636
"test-dependencies": {
3737
"elm-explorations/test": "1.2.2 <= v < 2.0.0"
3838
}
39-
}
39+
}

examples/html-styled/Main.elm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import Html
66
import Html.Styled exposing (..)
77
import Html.Styled.Attributes exposing (css, href, src)
88
import Html.Styled.Events exposing (onClick)
9+
import Svg.Styled as StyledSvg
10+
import Svg.Styled.Attributes as SvgAttribs
911

1012

1113
{-| A logo image, with inline styles that change on hover.
@@ -82,6 +84,7 @@ view model =
8284
nav []
8385
[ img [ src "assets/backdrop.jpg", css [ width (pct 100) ] ] []
8486
, btn [ onClick DoSomething ] [ text "Click me!" ]
87+
, StyledSvg.svg [ SvgAttribs.css [], SvgAttribs.width "100", SvgAttribs.height "100" ] [ StyledSvg.circle [ SvgAttribs.cx "50", SvgAttribs.cy "50", SvgAttribs.r "40" ] [] ]
8588
]
8689

8790

examples/html-styled/elm.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@
77
"elm-version": "0.19.0",
88
"dependencies": {
99
"direct": {
10-
"Skinney/murmur3": "2.0.7",
1110
"elm/browser": "1.0.0",
1211
"elm/core": "1.0.0",
1312
"elm/html": "1.0.0",
1413
"elm/json": "1.0.0",
15-
"rtfeldman/elm-hex": "1.0.0",
1614
"elm/virtual-dom": "1.0.0",
17-
"elm-explorations/markdown": "1.0.0"
15+
"elm-explorations/markdown": "1.0.0",
16+
"robinheghan/murmur3": "1.0.0",
17+
"rtfeldman/elm-hex": "1.0.0"
1818
},
1919
"indirect": {
2020
"elm/time": "1.0.0",
21-
"elm/url": "1.0.0",
22-
"elm/parser": "1.0.0"
21+
"elm/url": "1.0.0"
2322
}
2423
},
2524
"test-dependencies": {
2625
"direct": {
2726
"elm-explorations/test": "1.0.0"
2827
},
2928
"indirect": {
29+
"elm/parser": "1.0.0",
3030
"elm/random": "1.0.0"
3131
}
3232
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
"tmp": "0.0.28"
4545
},
4646
"devDependencies": {
47-
"elm-test": "0.18.13-beta",
47+
"chai": "3.4.1",
4848
"elm-format": "0.8.0",
49-
"chai": "3.4.1"
49+
"elm-test": "^0.19.1-revision7"
5050
},
5151
"engineStrict": true,
5252
"engines": {

src/VirtualDom/Styled.elm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,10 @@ extractUnstyledAttribute styles (Attribute val isCssStyles cssTemplate) =
492492
if isCssStyles then
493493
case Dict.get cssTemplate styles of
494494
Just classname ->
495-
VirtualDom.property "className" (Json.Encode.string classname)
495+
VirtualDom.attribute "className" classname
496496

497497
Nothing ->
498-
VirtualDom.property "className" (Json.Encode.string "_unstyled")
498+
VirtualDom.attribute "className" "_unstyled"
499499

500500
else
501501
val

0 commit comments

Comments
 (0)