- From: Garrett Smith <dhtmlkitchen@gmail.com>
- Date: Sat, 15 Sep 2007 13:41:29 -0700
- To: public-webapi@w3.org
http://www.w3.org/TR/progress-events/#Using The example loads an image, and then subscribes to progress events: function showImage(imageHref) { var image = document.getElementById('myImage'); image.setAttributeNS(xlinkNS, "href", imageHref); image.addEventListener("progress",imageLoadProgress,false); image.addEventListener("load",imageLoadComplete,false); } I'm not familiar with xlink, but if it causes the userAgent to synchronously request a resource, the imageLoadProgress won't get events. It seems like it would be necessary to first abort any call, then add listeners: // tab-width: 7 function showImage(imageHref) { var image = document.getElementById('myImage'); // Pretend we have an "abort()" method that stops loading. Removing the href attribute // won't stop the load request. image.abort(); image.addEventListener("progress",imageLoadProgress,false); image.addEventListener("load",imageLoadComplete,false); // Set the href attribute to kick off a synchronous req. image.setAttributeNS(xlinkNS, "href", imageHref); } Is this correct. Garrett -- Programming is a collaborative art.
Received on Saturday, 15 September 2007 20:41:33 UTC