Global object should be equal to the parent object.

Inside event handlers, the global object (`this`), should be equal to the object the event is being triggered on.

This fixes that, and adds a test for ir.