Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

splice() requires 2 arguments in IE8 #10

Open
dev101 opened this issue Nov 29, 2012 · 3 comments
Open

splice() requires 2 arguments in IE8 #10

dev101 opened this issue Nov 29, 2012 · 3 comments
Assignees
Labels
Milestone

Comments

@dev101
Copy link

dev101 commented Nov 29, 2012

It is a known bug in older versions of IE that it requires 2nd argument for Array.splice(), see e.g. this http://stackoverflow.com/a/8333160/1047880

This bug effectively prevents pubsub from retrieving published message (https://github.com/federico-lox/pubsub.js/blob/master/src/pubsub.js#L56) in IE7/8.

  • with missing argument Array.prototype.splice.call(args, 1) always returns empty object, resulting in always publishing empty message.

This contradicts with compatibility list declared at https://github.com/federico-lox/pubsub.js#supported-platforms.

@ghost ghost assigned federico-lox Nov 30, 2012
@federico-lox
Copy link
Owner

Thanks for the report.

I'll have a look :-)

@dev101
Copy link
Author

dev101 commented Feb 21, 2013

Probably I was not straightforward: in IE7/8, splice() requires 2 arguments, while you provide only 1.
Without the 2nd argument, splice() will silently do nothing in IE7/8, effectively returning empty array, see the screenshot from IE8 developer console.
So Array.prototype.splice.call(args, 1) should be changed to Array.prototype.splice.call(args, 1, args.length-1)

@federico-lox
Copy link
Owner

Thanks for the additional information.

The original report was pretty much clear, I just decided to consistently rework the code to get some improvements for all the targets (API, performace, testability) rather than just fix this specific issue for IE7/8.

In the version I'm (slowly) working on, this call and the usage of splat args will not be present anymore.

If you need this change in the short term let me know.

@federico-lox federico-lox added this to the 1.0 milestone May 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants