Proposals/load-events/

From SVG

Here are some testcases.

Proposal #1: Use a simple event 'load' for all loads, same as in html

Proposal #2: Deprecate (and/or remove) the SVGLoad event

Given that 'load' serves the same purpose as 'SVGLoad', 'SVGLoad' is not needed except for backwards compat.

Proposal #3: Only elements that have external resources should fire load events

Currently all svg elements can dispatch load events. We should restrict this to only include the elements that actually load anything external.

Proposal #4: In the same way as the above, replace 'SVGError' with 'error'

Proposal #5: In the same way as the above, replace 'SVGAbort' with 'abort'

Proposal #6: In the same way as the above, replace 'SVGUnload' with 'unload'

Proposal #7: Always fire the load event *after* the resource is fully loaded, but don't prevent rendering before that happens

Currently svg says [1]:

"The event is triggered at the point at which the user agent has fully parsed the element and its descendants and is ready to act appropriately upon that element, such as being ready to render the element to the target device. Referenced external resources that are required must be loaded, parsed and ready to render before the event is triggered. Optional external resources are not required to be ready for the event to be triggered.

SVGLoad events do not bubble and are not cancelable."

Proposal #8: Only fire one of 'error' or 'load' on a resource that fails to load

Currently spec doesn't say this should happen. Would make us match the html img element behaviour.

Issues

Should the outermost <svg> mirror the behaviour of <body>?

"The body element exposes as event handler content attributes a number of the event handlers of the Window object. It also mirrors their event handler IDL attributes.

The onblur, onerror, onfocus, onload, and onscroll event handlers of the Window object, exposed on the body element, replace the generic event handlers with the same names normally supported by HTML elements."

Consider the following scenarios:

  • a standalone svg document
  • (single or multiple) inline svg element(s) in html
  • svg document containing multiple <svg> elements

If we decide to not add this special treatment, does it make sense to still have load dispatched to the svg root?