Hi,
I figured out what was wrong. I took a look at SVGScriptElement.cpp in the
Webkit source, and in the method insertedIntoDocument, I found this snippet:
// Eventually send SVGLoad event now for the dynamically inserted script
element
if (!externalResourcesRequiredBaseValue()) {
setHaveFiredLoadEvent(true);
sendSVGLoadEventIfPossible();
}
Which to me looked like the load event would be fired immediately, if
externalResourcesRequired was set to false. Indeed, in Chromium nightly on
Ubuntu, setting externalResourcesRequired to "true" causes the load event to
be fired after the script loads. My patched RequireJS also now seems to be
working nicely.
It's not clear to me whether this behaviour conforms to the SVG spec:
http://www.w3.org/TR/SVG11/struct.html#ExternalResourcesRequiredAttribute
>From reading the spec, it seems like onload should be fired when the script
loads, regardless of whether it has externalResourcesRequired set to "true".
Also, it's not clear to me, does the spec require that,
if externalResourcesRequired is set to true on a script element, it will
block the rest of the document from loading until the script is evaluated?
I'd love to hear from the SVG implementers about whether their
implementations conform to this.
Cheers,
Jake
On Sun, Mar 27, 2011 at 3:01 PM, Jacob Beard <[email protected]> wrote:
> Hi,
>
> I'm trying to get the excellent RequireJS <http://requirejs.org/> script
> loader library to work in the context of pure SVG documents. I have this
> working in Firefox and Opera, but stable and nightly Chromium builds on
> Ubuntu 10.04 are failing to fire onload events at appropriate times: onload
> events are fired before the scripts are fully loaded, as opposed to after.
> Please consider the following reduced test case:
>
> http://stuff.echo-flow.com/svg-developers/test-script-onload.svg
>
> I wanted to report this as a bug to upstream Webkit, but it's typically
> good to first test against a nightly build of Webkit. Unfortunately, I
> haven't been able to get Webkit to build on Ubuntu 10.04, as Webkit now
> requires a later version of glibc than what is provided in the Ubuntu repos.
> I tested with a nightly Chromium build (same result), but I'm not sure if
> Chromium ships its own version of webkit, or is simply using the version of
> libwebkit already included on my Ubuntu install.
>
> Could someone with access to a nightly Webkit build try out the above test
> case and let me know whether or not it works?
>
> It seems peculiar to me that SVG script elements would have a different
> behaviour than HTML script elements, so I'll be interested to see what might
> be causing this. In the meantime, I'm going to ping the RequireJS list to
> see if it might be possible to apply a workaround in script.
>
> Cheers,
>
> Jake
>
[Non-text portions of this message have been removed]
------------------------------------
-----
To unsubscribe send a message to: [email protected]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/