Cleanup event handler factory code. Combine target and ancestor triggering and always pass the current delegate as the third parameter if delegating.