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

indent.js splits newlines incorrectly in internet explorer 11 #15

Closed
jessethomson opened this issue Apr 23, 2020 · 1 comment
Closed

Comments

@jessethomson
Copy link

jessethomson commented Apr 23, 2020

Problem

indent.js not working in internet explorer 11 due to the way lines are split. Specifically, the following line does not work correctly:

var lines = code.split(/[\r]?\n/gi);

Example

In Chrome, this "test\n".split(/[\r]?\n/gi) produces:

["test", ""]

In IE11, this "test\n".split(/[\r]?\n/gi) produces:

["t", "e", "s", "t", "  "]

Notes

Looks like there are a variety of issues with regular expressions in IE 11.

This seems to work in IE11 ("asdf\n" + "asdf\n" + "asdf\n").split("\n"), but I don't know if that works in all cases.

@jessethomson jessethomson changed the title indent.js not working in internet explorer 11 indent.js splits newlines incorrectly in internet explorer 11 Apr 23, 2020
@jessethomson
Copy link
Author

It looks like this is actually caused by a bug in the String.prototype.split polyfill from core-js.

See zloirock/core-js#751

Closing issue. Sorry for the false alarm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant