bean
bean copied to clipboard
IE8 can't fire native events on window
I saw the same bug reported here: #32 but the fix only solves custom events.
I'm trying to do something like this:
bean.on(window, 'resize', function () { /* something */ });
// ...
bean.fire(window, 'resize');
It works great on all browsers except for IE8 (and below I guess), it throws the error: Object doesn't support this property or method, because it tries to use fireEvent from window.
Here's a testing URL: https://dl.dropboxusercontent.com/u/12380956/ie8bug/index.html
For the time being I found a workaround by using a namespace.
bean.on(window, 'resize custom.resize', function () { /* something */ });
// ...
bean.fire(window, 'custom.resize');
Plus it prevents possible issues by firing third party code binded on those events, like described on this post.