caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Philippe Veber <philippe.veber@gmail.com>
To: Chapi Chapo <rixed@happyleptic.org>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] js_of_ocaml and <svg>
Date: Sat, 2 Jan 2016 22:30:17 +0100	[thread overview]
Message-ID: <CAOOOohQ_9ZaVf11RmAZG9BE42Lx93CGrdh=9cBcy1DKhm7Ghrg@mail.gmail.com> (raw)
In-Reply-To: <20160102204246.GA23759@pim.happyleptic.org>

[-- Attachment #1: Type: text/plain, Size: 1399 bytes --]

Drup provided the easiest answer, that is using Tyxml_js. In particular it
provides a functional (reactive) API to update the DOM, which is a lot
better than using the [createElement] functions. Also, using
[Dom_svg.document] here is not appropriate since you want the SVG fragment
to be embedded in HTML. This function should be used when the whole
document is an SVG.

2016-01-02 21:42 GMT+01:00 <rixed@happyleptic.org>:

> Indeed TyXML can generate XHTML trees with svg elements.
> But how to use that to update the DOM from JS generated by js_of_ocaml?
>
> # echo > toto.ml <<EOF
> let svg = Dom_svg.createSvg Dom_html.window##document
> EOF
> # ocamlfind ocamlc -syntax camlp4o -package "js_of_ocaml
> js_of_ocaml.syntax" -c toto.ml
> Error: This expression has type Dom_html.document Js.t
>        but an expression was expected of type Dom_svg.document Js.t
>        Type
>          Dom_html.document = (... yanked for sanity ...)
>        is not compatible with type
>          Dom_svg.document = (... yum yum ...)
>        The second object type has no method anchors
>
> Apparently that's a known issue of js_of_ocaml:
> https://github.com/ocsigen/js_of_ocaml/issues/276
>
> that I don't know how to work around nicely, may be because I have no idea
> how
> js_of_ocaml interacts with tyxml. I guess you are the pveber of that
> discussion
> so probably you can shed some light on this?
>

[-- Attachment #2: Type: text/html, Size: 2032 bytes --]

      parent reply	other threads:[~2016-01-02 21:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-02 17:43 rixed
2016-01-02 18:07 ` Philippe Veber
2016-01-02 20:42   ` rixed
2016-01-02 20:53     ` Spiros Eliopoulos
2016-01-02 20:56       ` Spiros Eliopoulos
2016-01-02 21:18     ` Drup
2016-01-02 21:30     ` Philippe Veber [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOOOohQ_9ZaVf11RmAZG9BE42Lx93CGrdh=9cBcy1DKhm7Ghrg@mail.gmail.com' \
    --to=philippe.veber@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=rixed@happyleptic.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).