From: Feross Aboukhadijeh Date: Tue, 12 Jan 2016 21:30:30 +0000 (+0100) Subject: safari 5-7 should use typed array impl X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=5f5478a34e8ed7b9642407b062e8c5edc6799510;p=buffer.git safari 5-7 should use typed array impl --- diff --git a/index.js b/index.js index ab8388f..1d22868 100644 --- a/index.js +++ b/index.js @@ -35,9 +35,6 @@ var rootParent = {} * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. * - * - Safari 5-7 lacks support for changing the `Object.prototype.constructor` property - * on objects. - * * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. * * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of @@ -51,13 +48,10 @@ Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined : typedArraySupport() function typedArraySupport () { - function Bar () {} try { var arr = new Uint8Array(1) arr.foo = function () { return 42 } - arr.constructor = Bar return arr.foo() === 42 && // typed array instances can be augmented - arr.constructor === Bar && // constructor can be set typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` } catch (e) {