Fixes an issue realted to the wrong context in events callbacks defined in the events hash, adds a proper test
Beautify the polyfill