Skip to content

Commit 3701c8b

Browse files
authored
Fixes ArrayBuffer and TypedArray.prototype.@@iterator detection in IE11 (#58)
This PR fixes `ArrayBuffer` and `TypedArray.prototype.@@iterator` detection; these are being incorrectly detected as present in IE11.
1 parent 3b924bc commit 3701c8b

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

polyfills/ArrayBuffer/detect.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// use "Int8Array" as a proxy for support of "TypedArray" subclasses
22
// confirm that the prototype of "Int8Array" is NOT the "Object" prototype, which is a bug in IE11 and maybe other old browsers
33
'ArrayBuffer' in self && 'DataView' in self && 'Int8Array' in self
4+
// IE11 has an incomplete implementation that's missing `slice` and maybe others
5+
&& 'slice' in self.Int8Array.prototype
46
// TODO: add back this check once we remove support for ie10 and below
57
// && Object.getPrototypeOf(self.Int8Array) !== Object.getPrototypeOf(Object)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// use "Int8Array" as a proxy for support of "TypedArray" subclasses
2-
'Symbol' in self && 'iterator' in self.Symbol && 'Int8Array' in self && self.Symbol.iterator in self.Int8Array.prototype
2+
'Symbol' in self && 'iterator' in self.Symbol && 'Int8Array' in self && self.Symbol.iterator in self.Int8Array.prototype && self.Int8Array.prototype[self.Symbol.iterator] !== undefined

polyfills/TypedArray/prototype/@@iterator/polyfill.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
it('is an alias to %TypedArray%.prototype.values', function () {
66
if ('__proto__' in Int8Array.prototype && self.Int8Array.prototype.__proto__ !== Object.prototype) {
7+
proclaim.isDefined(Int8Array.prototype.__proto__[Symbol.iterator]);
78
proclaim.deepEqual(Int8Array.prototype.__proto__[Symbol.iterator], Int8Array.prototype.__proto__.values);
89
} else {
10+
proclaim.isDefined(Int8Array.prototype[Symbol.iterator]);
911
proclaim.deepEqual(Int8Array.prototype[Symbol.iterator], Int8Array.prototype.values);
1012
}
1113
});

0 commit comments

Comments
 (0)