[svg-developers] onload event is not firing when image added via script

2007-10-11 Thread shellshear
Hello chaps,

I'm playing around with SVG on Opera (fun!), but I'm having trouble
with the onload event - I'd like to be notified when an image I add
(through the DOM) has loaded, as per the example below.  But in Opera
9.23 it doesn't appear to do the onload.  Am I misinterpreting how
onload is supposed to work?  Is it a bug or feature-to-be-implemented
in Opera?

(What I want to do is display a movie one frame at a time so that
there aren't any visual glitches - I figure I need to display an
image, load the new image in front with display=none, and when the
new image has finished loading change the display to inline and
remove the old image from behind).

Cheers,

Andrew.

In the below example, I would expect (provided test.jpg is in the
correct place) first an alert foo, then an alert bar.  However,
only the first event is triggered.

?xml version=1.0?
svg 
xmlns=http://www.w3.org/2000/svg; 
xmlns:xlink=http://www.w3.org/1999/xlink;
version=1.1 
viewBox=0 0 200 200
onload=init()

script type=text/ecmascript
![CDATA[
function init()
{
var img1 = document.createElement(image);
img1.setAttribute('height', 100);
img1.setAttribute('width', 100);
img1.setAttribute('onload', alert('bar'););
img1.setAttributeNS('http://www.w3.org/1999/xlink',
'xlink:href', 'test.jpg');
document.getElementById(test).appendChild(img1);
}
]]
/script
  
g id=test/

image x=100 y=0 height=100 width=100
onload=alert('foo'); xlink:href=test.jpg/

/svg




-
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:
mailto:[EMAIL PROTECTED] 
mailto:[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/
 


Re: [svg-developers] onload event is not firing when image added via script

2007-10-11 Thread Erik Dahlström
On Thu, 11 Oct 2007 08:38:21 +0200, shellshear [EMAIL PROTECTED] wrote:

 Hello chaps,

 I'm playing around with SVG on Opera (fun!), but I'm having trouble
 with the onload event - I'd like to be notified when an image I add
 (through the DOM) has loaded, as per the example below.  But in Opera
 9.23 it doesn't appear to do the onload.  Am I misinterpreting how
 onload is supposed to work?  Is it a bug or feature-to-be-implemented
 in Opera?

It worked fine if I switched the setAttribute(onload) bit for this:
img1.addEventListener(load, function() { alert('bar'); }, false);

FF2 behaves the same as Opera here, and Safari 3.0.2 strangely reported  
more than a few load events.

Not sure if there should be a difference between setting onload and  
registering an eventlistener, will follow up on that.

Cheers
/Erik

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


-
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:
mailto:[EMAIL PROTECTED] 
mailto:[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/