W3C home > Mailing lists > Public > www-svg@w3.org > September 2007

Re: OnLoad vs Rendition. FireFox vs Opera. which is correct?

From: Erik Dahlström <ed@opera.com>
Date: Thu, 20 Sep 2007 10:26:08 +0200
To: Rick <graham.rick@gmail.com>, www-svg@w3.org
Message-ID: <op.tyx1purtgqiacl@gnorps.palace.opera.no>
On Tue, 18 Sep 2007 20:56:03 +0200, Rick <graham.rick@gmail.com> wrote:

>
> SVG-WG:
>
> Hi guys.
>
> I have an application that runs a script at onload.  This is common  
> enough.
>
> Firefox runs the script first and then renders the image.
>
> Opera renders first and then runs the script.
>
> Is this behaviour defined by the spec?

Firefox version? Opera version? Spec version? :)
I'm assuming 2.0, 9.2 and 1.1 respectively.

For SVG Tiny 1.2 this may be of interest:
   http://www.w3.org/TR/SVGMobile12/struct.html#ProgressiveRendering

In particular:
"The SVG User Agent has the opportunity to update the rendering following  
each 'start element' and/or 'end element' event, i.e. each time the SVG  
User Agent parses a Start-Tag, Empty-Element Tag or End-Tag."

> 16.2 / onload says: 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.

Since neither Opera (9.2) or Firefox (2.0) supports  
'externalResourcesRequired' it's not guaranteed that the resources are  
fully loaded when the load event is fired.
Had it been supported you could have added  
externalResourcesRequired="true" to the elements that you absolutely  
needed to have external resources loaded for before rendering is  
continued. Opera 9.5 adds support for 'externalResourcesRequired', and you  
are welcome to test and report any bugs you find to  
http://bugs.opera.com/wizard.
Note that in your testcase it wouldn't have made a difference since you  
don't have external scripts or other resources.

> Is this a bug?  I believe that it is.

Consider this: the alert dialog may be asynchronous, which means that the  
svg may render even when the dialog is active, or as it is being displayed.
I don't think the spec forbids this, nothing in the onload text says that  
the onload has to be handled before rendering happens. Also you may want  
to consider the fact that this is what HTML seems to be doing, in all  
tested browsers, see attachment.

Another possiblity is if the onload event is fired and rendering is done  
before the event is handled?
Or if the onload handler does lengthy processing, would you not want to  
see something while it's running?
The DOM methods suspendRedraw/unsuspendRedraw are meant to be used if you  
want to prevent svg rendering while updating the document tree.

> Who do I file the bug with?
> bugs.opera.com is not responding, so I don't know if there is a bug
> filed there.  I found nothing with a cursory Google on the matter.

That is the right place to file Opera bugs, and it is responding now. Not  
sure what was the problem when you tried. Problems with that server are  
usually fixed quickly.

> I'm not particularly fussy about which behavior is correct, but my
> feeling, and my interpretation of the above is that FF is correct and
> that Opera is in error when it renders before running a script
> triggered by the onload event.

I'm not convinced that the spec (1.1 or 1.2T) mandates the behaviour you  
see in Firefox.
/Erik

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


Received on Thursday, 20 September 2007 08:24:52 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 10 December 2014 19:59:27 UTC