Fork me on GitHub
#reagent
<
2020-10-18
>
rcecchino12:10:49

Wondering why on-load for SVG isn't firing:

[:svg {:height "100"
       :width  "100"
       :on-load #(js/alert "SVG loaded.")}
       [:circle {:cx "50" :cy "50" :r "40" :stroke "black" :stroke-width "3" :fill "red"}]]

rcecchino12:10:24

Similar HTML does work:

<html>
 <body>
  <svg height="100" width="100" onload="javascript: alert('SVG loaded.');">
   <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
  </svg>
 <body>
<html>

victorb12:10:27

@rcecchino don't think React supports using onLoad. You better off grabbing a reference via ref and then setting the listener manually

rcecchino12:10:08

Thanks @victorbjelkholm429. Assembled a quick React app and it is in fact not working there. Will go the ref route. Thanks!

🙏 1