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.


Misplaced curly brace