Skip to content

Commit bbb264b

Browse files
author
vvo
committed
fix(browser support): make IE lte 10 work by fixing Object.getPrototypeOf
broken since babel6, see https://phabricator.babeljs.io/T3041
1 parent 8025a5c commit bbb264b

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/lib/main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
// required for browsers not supporting this (helper requirement)
1+
// required for browsers not supporting Object.freeze (helper requirement)
22
import '../shams/Object.freeze.js';
3+
4+
// required for IE <= 10 since move to babel6
5+
import '../shims/Object.getPrototypeOf.js';
6+
37
import toFactory from 'to-factory';
48
import InstantSearch from './InstantSearch.js';
59
import algoliasearchHelper from 'algoliasearch-helper';

src/shims/Object.getPrototypeOf.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* eslint-disable */
2+
3+
// FIX IE <= 10 babel6:
4+
// - https://phabricator.babeljs.io/T3041
5+
// - https://phabricator.babeljs.io/T3041#70671
6+
var testObject = {};
7+
8+
if (!(Object.setPrototypeOf || testObject.__proto__)) {
9+
var nativeGetPrototypeOf = Object.getPrototypeOf;
10+
11+
Object.getPrototypeOf = function(object) {
12+
if (object.__proto__) {
13+
return object.__proto__;
14+
} else {
15+
return nativeGetPrototypeOf.call(Object, object);
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)