PDA

View Full Version : [OPEN-1296] Bug in swfobject::addLoadEvent



vot
29 Sep 2010, 1:49 AM
Hello,

i think i've found a bug in the swfobject::addLoadEvent function.


function addLoadEvent(fn) {
if (typeof win.addEventListener != UNDEF) {
win.addEventListener("load", fn, false);
}
else if (typeof doc.addEventListener != UNDEF) {
doc.addEventListener("load", fn, false);
}
else if (typeof win.attachEvent != UNDEF) {
addListener(win, "onload", fn);
}
else if (typeof win.onload == "function") {
var fnOld = win.onload;
win.onload = function() {
fnOld();
fn();
};
}
else {
win.onload = fn;
}
}
I think this should be:


else if (typeof win.attachEvent != UNDEF) {
attachEvent("onload", fn);
}
Regards
Volker