Loading ...
Sorry, an error occurred while loading the content.

How to tell when an element has loaded into an html5 document?

Expand Messages
  • Bryan Berry
    svg buddies, does an svg element emit any kind of event when embedded in an html page so that I can tell it is loaded? i am writing a little html5 helper
    Message 1 of 2 , Nov 15, 2009
    • 0 Attachment
      svg buddies, does an svg element emit any kind of event when embedded in
      an html page so that I can tell it is loaded?

      i am writing a little html5 helper library that has .ready( /*your app
      code here */) method that runs your app code after all the html5 audio,
      images, and svg elements have loaded.

      http://git.sugarlabs.org/projects/karma/repos/mainline/blobs/jkjs-refactor/js/karma.js


      --
      Bryan W. Berry
      Senior Engineer
      OLE Nepal, http://www.olenepal.org
    • Cameron Laird
      On Sun, Nov 15, 2009 at 10:53:51AM -0500, Bryan Berry wrote: . . . ... . . . Absolutely; it s just the onload() you d expect. Let s be more concrete about
      Message 2 of 2 , Nov 15, 2009
      • 0 Attachment
        On Sun, Nov 15, 2009 at 10:53:51AM -0500, Bryan Berry wrote:
        .
        .
        .
        > svg buddies, does an svg element emit any kind of event when embedded in
        > an html page so that I can tell it is loaded?
        .
        .
        .
        Absolutely; it's just the onload() you'd expect.

        Let's be more concrete about this, as even your simple desription
        leaves quite a few variabls unbound. A construct like

        <object id = "my_image" type = "image/svg+xml"
        data = "my_image.svg"
        onload = "do_important_thing();" ...>

        does just what I need in such situations. Notice you can get much
        of the same effect by working with event properties, named scripts,
        ...

        Do you want the event-handler to be *within* the SVG? That's also
        possible, but a different thing. If this, or some other variation,
        is what you're truly after, don't hesitate to follow-up here.
      Your message has been successfully submitted and would be delivered to recipients shortly.