How do I run a Javascript function when the content of an `<object>` has been loaded? The `DOMContentLoaded` event fires before that, and things that rely on it like JQuery's `$()` likewise.

Compare [this](http://plnkr.co/edit/znu5iz3OLLh4lAzWnQI1?p=preview) to [this](http://plnkr.co/edit/XIH3f0gxRqw3TzYEthmD?p=preview). 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.

Polling works in practice, but is there a better solution for this? Ideally there would be an event fired that I can use.