Skip to content

Commit

Permalink
fix(Carousel): ie11 compatibility changes(reactstrap#1571)
Browse files Browse the repository at this point in the history
This applies the CustomEvent polyfill recommended in the [MDN web
docs](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill). This also applies a simple polyfill I found in the (react-transition-group module)[https://github.com/reactjs/react-transition-group/blob/9e3b2d3c09b78e755bdc837b7b38337812ede2c9/src/TransitionGroup.js#L11].

I don't think this has much potential to break anything, since these
will only impact browswers where these features are already broken.
  • Loading branch information
nathanbacon committed Jul 19, 2019
1 parent b4edeb8 commit 164ccbc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.js
Expand Up @@ -85,3 +85,4 @@ export UncontrolledDropdown from './UncontrolledDropdown';
export UncontrolledTooltip from './UncontrolledTooltip';
export Spinner from './Spinner';
export * as Util from './utils';
export * as Polyfill from './polyfill'
20 changes: 20 additions & 0 deletions src/polyfill.js
@@ -0,0 +1,20 @@
(() => {
if ( typeof window.CustomEvent === 'function' ) return;

const CustomEvent = (( event, params ) => {
params = params || { bubbles: false, cancelable: false, detail: null };
var evt = document.createEvent( 'CustomEvent' );
evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
return evt;
});

window.CustomEvent = CustomEvent;
})();

(() => {
if ( typeof Object.values === 'function' ) return;

const values = ( (O) => Object.keys(O).map((key) => O[key]) );

Object.values = values;
})();

0 comments on commit 164ccbc

Please sign in to comment.