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

Update code to ensure IE11 compatibility #406

Merged
merged 1 commit into from
Jun 15, 2017
Merged

Update code to ensure IE11 compatibility #406

merged 1 commit into from
Jun 15, 2017

Conversation

oigewan
Copy link

@oigewan oigewan commented Jun 15, 2017

Bug:
Fixes #403

As mentioned in the issue, this library breaks in IE11 due to missing polyfills. You could just document the polyfill requirements for this library, but since IE 11 is still over 2% of browser usage and this is a library, it'd be a good idea to remove code that's incompatible with IE11.

Unfortunately, some babel plugins also add code that's incompatible by default. The main culprit here is the use of the spread operator to clone a NodeList to an array. Babel uses a helper for the spread operator, and that helper uses Array.from. Therefore, using the spread operator to clone an array isn't something that can be done here any more.

Notes:
Babel documentation on the plugins I'm using and dependencies I added.

Changes:

  • Install the object-assign ponyfill and use it instead of Object.assign
  • Replace all usages of the [...dayNodes].indexOf(...) code with something equivalent, but more IE friendly.

cc: @gpbl

Copy link
Owner

@gpbl gpbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Sorry for the issue with @coveralls 👎

src/DayPicker.js Outdated
@@ -12,6 +12,10 @@ import classNames from './classNames';
import keys from './keys';
import PropTypes, { ModifierPropType } from './PropTypes';

function nodeListToArray(nodeList) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind to move this to Helpers.js? Thanks!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@gpbl gpbl added this to the v5.6.0 milestone Jun 15, 2017
@oigewan
Copy link
Author

oigewan commented Jun 15, 2017

@gpbl Issue addressed. Did a rebase and force pushed to the branch

@oigewan oigewan changed the title Update code to ensure IE11 incompatibility Update code to ensure IE11 compatibility Jun 15, 2017
@gpbl gpbl merged commit 1353db7 into gpbl:master Jun 15, 2017
@gpbl
Copy link
Owner

gpbl commented Jun 15, 2017

perfect 👌🏽

@oigewan
Copy link
Author

oigewan commented Jun 15, 2017

Thanks for reviewing and merging @gpbl. Any idea on when you're gonna do your next release?

@oigewan oigewan deleted the ie11 branch June 20, 2017 03:36
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

Successfully merging this pull request may close these issues.

2 participants