Skip to content

Commit

Permalink
fix(browser support): make IE lte 10 work by fixing Object.getPrototy…
Browse files Browse the repository at this point in the history
…peOf

broken since babel6, see https://phabricator.babeljs.io/T3041
  • Loading branch information
vvo committed Mar 2, 2016
1 parent 8025a5c commit bbb264b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// required for browsers not supporting this (helper requirement)
// required for browsers not supporting Object.freeze (helper requirement)
import '../shams/Object.freeze.js';

// required for IE <= 10 since move to babel6
import '../shims/Object.getPrototypeOf.js';

import toFactory from 'to-factory';
import InstantSearch from './InstantSearch.js';
import algoliasearchHelper from 'algoliasearch-helper';
Expand Down
18 changes: 18 additions & 0 deletions src/shims/Object.getPrototypeOf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-disable */

// FIX IE <= 10 babel6:
// - https://phabricator.babeljs.io/T3041
// - https://phabricator.babeljs.io/T3041#70671
var testObject = {};

if (!(Object.setPrototypeOf || testObject.__proto__)) {
var nativeGetPrototypeOf = Object.getPrototypeOf;

Object.getPrototypeOf = function(object) {
if (object.__proto__) {
return object.__proto__;
} else {
return nativeGetPrototypeOf.call(Object, object);
}
}
}

0 comments on commit bbb264b

Please sign in to comment.