blackberry/Ripple-UI — Issue #217: [ripple/boostrap] does not pass event object to listeners on window load/DOMContentLoaded
Author: brentlintner
Created: 2011-10-28 03:12:21+00:00
State: open
Labels: Bug, High Severity

**Steps**

1. Run this code:

```javascript
window.addEventListener('load', function () {
console.log(arguments);
});
```
Expected: An Event object to be passed into callback (as first arg)
Actual: Empty object

A user reported this as well (happening in a MS Ajax framework (see this [app](http://m.azbar.org/) for example)), where the eventObject (first arg) comes back it does not have a type attribute (i.e. undefined.toLowerCase())

The main issue is here: https://github.com/blackberry/Ripple-UI/blob/next/lib/ripple/bootstrap.js#L66

At a brief look, I think this should be easy enough to fix by manually listening for those events (DOMContentLoaded comes first, and onload is where they are both fired).

**Note**: Update the console.error logging as well (errors are not helpful without stack trace) to:

```javascript
console.error(e.stack || e);
```