component/delegate — pull request #3 by ForbesLindesay (2013-01-21 14:29:08+00:00)
Title: Fix delegate with child elements

Fixes the same issue as #2 but does it without extending prototypes and in-lining dependencies.

Before it would only check the event target now it checks everything between the target and the element with the event handler attached.

That way something like:

```html
click here

```

```javascript
var delegate = require('delegate');
var ul = document.querySelector('ul');
var n = 0;

var fn = delegate.bind(ul, 'li', 'click', function(e){
console.log(e.delegateTarget);
if (++n == 3) {
console.log('unbind');
delegate.unbind(ul, 'click', fn, false);
}
}, false);
```

Would still catch the click on li.