LexiFi / ocaml-vdom

Elm architecture and (V)DOM for OCaml
MIT License
197 stars 13 forks source link

`svg_elt` "path" get's rendered without attributes #41

Open tcoopman opened 3 years ago

tcoopman commented 3 years ago

The following code:

svg_elt "svg" [
svg_elt  ~a:[ clip_rule "evenodd"; d "M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z"; fill_rule "evenodd" ] []
]

gets rendered as:

<svg><path></path></svg>

while I expected the path to look like: <path fill-rule="evenodd" d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z" clip-rule="evenodd"></path>

alainfrisch commented 3 years ago

How are clip_rule, d and fill_rule defined?

tcoopman commented 3 years ago
let clip_rule = str_prop "clip-rule"
let fill_rule = str_prop "fill-rule"
let fill = str_prop "fill"
let viewBox = str_prop "viewBox"
let xmlns = str_prop "xmlns"
let d = str_prop "d"
alainfrisch commented 3 years ago

I'm not very familiar with SVG, but I suspect these must be defined as attributes, not as DOM properties. Can you try with attr instead of str_prop?