Remember that JavaScript is a programming language after all.  You can use a
loop to get rid of the repetitions.
Start from
var done = ["load", "error", "abort"]...
and apply the closure image.aEL(?, hPB, false) to it.
Sincerely,
Chris

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Garrett Smith
Sent: Sunday, August 26, 2007 8:25 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [whatwg] Progress Events "done" event


==========================================
function showImage(imageHref) {
...

// remove the progress bar when done.
       image.addEventListener("load", hideProgressBar, false);
       image.addEventListener("error", hideProgressBar, false);
       image.addEventListener("abort", hideProgressBar, false);
}
==========================================

This is somewhat verbose. Clearly, the author is forced to repeat
himself when all he really wants to do is hide the progress bar after
the call is done.




Reply via email to