Fix test fails in Safari 5.

This commit is contained in:
John-David Dalton
2014-07-22 09:42:34 -07:00
parent 14a99471f4
commit 49a88e75e6
2 changed files with 16 additions and 5 deletions

View File

@@ -660,7 +660,6 @@
bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) && bufferSlice,
ceil = Math.ceil,
clearTimeout = context.clearTimeout,
Float64Array = isNative(Float64Array = context.Float64Array) && Float64Array,
floor = Math.floor,
getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf,
hasOwnProperty = objectProto.hasOwnProperty,
@@ -672,6 +671,18 @@
Uint8Array = isNative(Uint8Array = context.Uint8Array) && Uint8Array,
unshift = arrayProto.unshift;
/** Used to clone array buffers */
var Float64Array = (function() {
// Safari 5 errors when using an array buffer to initialize a typed array
// where the array buffer's `byteLength` is not a multiple of the typed
// array's `BYTES_PER_ELEMENT`
try {
var func = isNative(func = context.Float64Array) && func,
result = new func(new ArrayBuffer(10), 0, 1) && func;
} catch(e) { }
return result;
}());
/** Used to set metadata on functions */
var defineProperty = (function() {
// IE 8 only accepts DOM elements