(fn)
| 183 | - Will fire an event as soon as a web page including all of its assets are loaded |
| 184 | */ |
| 185 | function addLoadEvent(fn) { |
| 186 | if (typeof win.addEventListener != UNDEF) { |
| 187 | win.addEventListener("load", fn, false); |
| 188 | } |
| 189 | else if (typeof doc.addEventListener != UNDEF) { |
| 190 | doc.addEventListener("load", fn, false); |
| 191 | } |
| 192 | else if (typeof win.attachEvent != UNDEF) { |
| 193 | addListener(win, "onload", fn); |
| 194 | } |
| 195 | else if (typeof win.onload == "function") { |
| 196 | var fnOld = win.onload; |
| 197 | win.onload = function() { |
| 198 | fnOld(); |
| 199 | fn(); |
| 200 | }; |
| 201 | } |
| 202 | else { |
| 203 | win.onload = fn; |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | /* Main function |
| 208 | - Will preferably execute onDomLoad, otherwise onload (as a fallback) |
no test coverage detected