weixiyen/jquery-defaultText — Issue #4: Uncaught TypeError: Cannot call method 'unshift' of undefined
Author: hannesgassert
Created: 2011-12-13 13:03:58+00:00
State: open

In Google Chrome I get an error in the console log saying "Uncaught TypeError: Cannot call method 'unshift' of undefined", but $.defaultText is still working perfectly fine otherwise.

The error is triggered by `$.data(ele.get(x), "events")[type].unshift({..}..` when binding the `clear_events`.

I'm not sure this is the correct solution, but making sure there's an array helped for me:

```
if("array" !== typeof $.data( ele.get(x), "events" )[type]) {
$.data(ele.get(x), "events")[type] = [];
}
```

Thanks for taking a look at this.