yields/k — pull request #13 by dandean (2013-09-27 20:34:45+00:00)
Title: Do not call Array#slice if handler not found.

`k.unbind` is broken.

Array#slice will remove items from the end of the array if a negative index is given for the `index` argument.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice#Syntax

This behavior is giving your `unbind` test a false pass because you're just verifying the length of the handler array, not actual content. During the `unbind` call, the actual handler isn't found, so -1 is returned. You then call slice using -1 for the index, which removes the last handler in the array no matter what. You then check the length and see that the handler array is the correct length and assume success.

The handler array is actually an array of objects in this format:

`{ fn: Function, mods: Array }`

So calling `indexOf` and passing the handler function cannot succeed.