diff --git a/src/event.js b/src/event.js index 227ac2648..bb3af6e15 100644 --- a/src/event.js +++ b/src/event.js @@ -182,7 +182,7 @@ if (!isString(selector) && !isFunction(callback) && callback !== false) callback = data, data = selector, selector = undefined - if (isFunction(data) || data === false) + if (callback === undefined || data === false) callback = data, data = undefined if (callback === false) callback = returnFalse diff --git a/test/event.html b/test/event.html index d7888bc6a..9cf343240 100644 --- a/test/event.html +++ b/test/event.html @@ -274,6 +274,21 @@

Zepto Event unit tests

t.assertEqual(1, numArgs) t.assertIdentical(data, gotData) }, + + testHandlerWithFunctionAsData: function(t){ + var data = function () { console.log('foo') }, + gotData, numArgs + + $(document).on('click', data, function(event){ + gotData = event.data + numArgs = arguments.length + }) + t.assertUndefined(gotData) + + click(this.el) + t.assertEqual(1, numArgs) + t.assertIdentical(data, gotData) + }, testDelegatedWithData: function(t){ var data = {}, gotData, numArgs