:gb: Refined and tested dispatchEvent method