[Ur] calling javascript code in <dyn>

Fabrice Leal fabrice.leal.ch at gmail.com
Mon Oct 22 19:16:07 EDT 2018


@AdamChlipala

Actually that sounds like what was happening to me, but can't be 100% sure
- I can't track the issue on github, I might have skipped a few commits
while working out this issue. At the time I read somewhere what I stated
above and moved on.

The onload of an <img> seems to work regardless of being a top level tag or
being dynamically generated (and here I assume calling "new Image()"
generates an <img>: that's what the chrome console seems to imply)

I'm giving it use in my canvas lib:

https://github.com/fabriceleal/urweb-canvas/blob/master/demos/demos.ur#L292
https://github.com/fabriceleal/urweb-canvas/blob/master/src/canvas.js#L46

On Mon, Oct 22, 2018 at 11:59 PM Fabrice Leal <fabrice.leal.ch at gmail.com>
wrote:

> Addendum: I never tried the onload on <img> from urweb, but on js land it
> works
>
> On Mon, Oct 22, 2018 at 11:50 PM Fabrice Leal <fabrice.leal.ch at gmail.com>
> wrote:
>
>> @AdamChlipala
>>
>> At the time I implemented an onload attribute for <div> on basis.ur and
>> only later found out if was for no good on html/js land: the only onload
>> that gets triggered is the one defined on <body>, setting onload for any
>> other child tag has no "side effects"; so I scrapped that.
>>
>> Sorry for the vagueness :)
>>
>> I did end up using <active code={...} /> and that worked for me
>>
>
>
> --
> ---
> Fabrice Leal
>


-- 
---
Fabrice Leal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20181023/b27f2747/attachment.html>


More information about the Ur mailing list