tildeio / MessageChannel.js

27 stars 3 forks source link

Fix ie8 support #20

Closed hjdivad closed 10 years ago

hjdivad commented 10 years ago

IE8 support is broken in 0.1.4, which is preventing #19 from passing. The issue is that we rely on attachEvent.apply when shadowing it. Recall that we shadow attachEvent to save people who don't already check message sources on their event listeners, which is perhaps already doing too much to save people from themselves.

Probably the best way out is to have the original attachEvent saved on window rather than in a closure. We should certainly not do this for addEventListener.

cyril-sf commented 10 years ago

IE8 support is not broken. Window.prototype.attachEvent.apply isn't a javascript Function for Internet Explorer 8 and raises an exception when calling toString on it ("Object doesn't support this property or method"), which can lead to that confusion.

But Window.prototype.attachEvent.apply(this, args) is valid call. The test Multiple message listeners can be added to a window covers that part.

hjdivad commented 10 years ago

hooray ie8 ^_^