title: Run Javascript function when object content has been loaded
body: <p>How do I run a Javascript function when the content of an <code>&lt;object&gt;</code> has been loaded? The <code>DOMContentLoaded</code> event fires before that, and things that rely on it like JQuery's <code>$()</code> likewise.</p>
  
  <p>Compare <a href="http://plnkr.co/edit/znu5iz3OLLh4lAzWnQI1?p=preview" rel="noreferrer">this</a> to <a href="http://plnkr.co/edit/XIH3f0gxRqw3TzYEthmD?p=preview" rel="noreferrer">this</a>. The first example fails because the function is executed when the external SVG hasn't been loaded. The second example polls for the elements it wants to change and only then executes the relevant code, and succeeds.</p>
  
  <p>Polling works in practice, but is there a better solution for this? Ideally there would be an event fired that I can use.</p>