ocaml-vdom icon indicating copy to clipboard operation
ocaml-vdom copied to clipboard

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

Open tcoopman opened this issue 3 years ago • 3 comments

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>

tcoopman avatar Jul 21 '21 08:07 tcoopman

How are clip_rule, d and fill_rule defined?

alainfrisch avatar Aug 09 '21 10:08 alainfrisch

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"

tcoopman avatar Aug 10 '21 07:08 tcoopman

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?

alainfrisch avatar Aug 10 '21 14:08 alainfrisch