madrobby/zepto — Issue #361: Thrown during an event callback: "Uncaught TypeError: Cannot call method 'apply' of undefined"
Author: lukevenediger
Created: 2011-12-27 21:16:12+00:00
State: open

Hi,

I'm binding to a checkbox and listening for the change event, like so:
```javascript
$('#foo_checkbox').bind('change', function(e) {
alert('hello');
});
```

But this error appears in the console log window when I click the checkbox:
Uncaught TypeError: Cannot call method 'apply' of undefined - zepto.js:549

Taking a look at this line, it seems to be that the event handler proxy function is trying to augment the "data" property of the event, which doesn't exist:
```
var result = callback.apply(element, [event].concat(event.data));
```
What's also interesting is that the proxy function is called twice per event. The first call passes but the second call fails with the error message. Is this a bug, or am I setting up my event handler incorrectly?

Browser: Chrome 16.0.912.63 m

Thanks,
Luke