November 12, 2006
@ 03:32 PM

So a few weeks ago I wrote a moderately popular embedded video gadget for Windows Live Spaces which allows you to embed videos from popular video sharing sites on your Live.com or Spaces page. Somewhere along the line it seems that this gadget stopped working correctly in Firefox. Specifically click events on the [Preview] and [Save] buttons were not working. After doing some research I came across an article entitled addEventListener attachEvent - Pass parameters to event-function which made me realize that I had to change my code from

btn2.attachEvent("onclick", OnSave);
to
if(window.addEventListener){
     btn2.addEventListener("click", OnSave, true); //Firefox
}else{
     btn2.attachEvent("onclick", OnSave); //MSIE
}
I'm pretty sure that the code used to work at one point in time and from this post on Adam Kinney's blog it does seem that the Atlas framework which is what is used by the Windows Live gadgets platform did write a cross-browser version of attachEvent. I wonder if they took that change out due to negative feedback from developers? I guess this is just another example of why I think trying to standardize gadget widget packaging and then expecting it'll lead to interop between gadget widget platforms is an amusingly naive idea. See the discussion in the comments to my post entitled W3C Working on Widgets 1.0 Spec for more context. :)

UPDATE: Kevin Daly just posted a comment in response to this post which links to a blog post entitled DOM events in the Microsoft AJAX Library. The post confirms that negative developer feedback led to a change in Atlas which breaks event handling in Firefox for any app written against previous versions of the Atlas framework as I speculated above. I've just spent 15 minutes updating and resubmitting all my old gadgets to Windows Live Gallery. If you are a gadget developer you may want to check out your code as well. 

PS: Visit http://carnage4life.spaces.live.com to see what it looks like to embed an MSN SoapBox video in your blog.


 

Sunday, 12 November 2006 15:57:50 (GMT Standard Time, UTC+00:00)
I don't know if this is relevant, but they've changed the model for adding client-side events in the Beta version of The Framework Formerly Known As Atlas.

There's an explanation here:
http://weblogs.asp.net/bleroy/archive/2006/11/06/DOM-events-in-the-Microsoft-AJAX-Library.aspx
Sunday, 12 November 2006 16:10:45 (GMT Standard Time, UTC+00:00)
Kevin,
I've updated my post and added the that link.

Thanks.
Sunday, 12 November 2006 22:17:44 (GMT Standard Time, UTC+00:00)
Hm, pretty sure the live js framework and atlas diverged some time ago, and don't depend or synch up at all anymore. While I'm glad to see Atlas move to a slightly more standards-oriented approach, that shouldn't directly affect Live stuff one way or the other now.
DonD
Monday, 13 November 2006 09:17:30 (GMT Standard Time, UTC+00:00)
Dare

Why is your blog disappearing frequently these days? I again saw a DNS error this morning.

Vivek
Vivek Ravindran
Comments are closed.