Fixes #6024: Adds support for ":before" and ":after" events

After events cannot be cancelled, all handlers always run.