The event phase AT_TARGET should also fire events registered with capture=true on the event target, not just capture=false.

See #855

This pull request also fixes two smaller issues that I found while making my changes.


oh, force of habit. I usually put newlines before all my curly's ;)