Closed sukovec closed 10 years ago
Hi,
Opera 12 is little buggy with typed arrays, BYTES_PER_ELEMENT is not defined in prototypes, so some functions in ds.js are not working. Simplest workaround (possibly the only and most simple bugfix) is to define it in prototypes like this:
if (Uint8Array.prototype.BYTES_PER_ELEMENT == undefined) { Uint8Array.prototype.BYTES_PER_ELEMENT = Uint8Array.BYTES_PER_ELEMENT; Int8Array.prototype.BYTES_PER_ELEMENT = Int8Array.BYTES_PER_ELEMENT; Uint8ClampedArray.prototype.BYTES_PER_ELEMENT = Uint8ClampedArray.BYTES_PER_ELEMENT; Uint16Array.prototype.BYTES_PER_ELEMENT = Uint16Array.BYTES_PER_ELEMENT; Int16Array.prototype.BYTES_PER_ELEMENT = Int16Array.BYTES_PER_ELEMENT; Uint32Array.prototype.BYTES_PER_ELEMENT = Uint32Array.BYTES_PER_ELEMENT; Int32Array.prototype.BYTES_PER_ELEMENT = Int32Array.BYTES_PER_ELEMENT; Float64Array.prototype.BYTES_PER_ELEMENT = Float64Array.BYTES_PER_ELEMENT; }
Good catch, thanks! Maybe we could also use arr.constructor.BYTES_PER_ELEMENT in the library, if that's more cross-browser.
If you've got this snippet in a branch, send me a PR and I'll merge.
Hi,
Opera 12 is little buggy with typed arrays, BYTES_PER_ELEMENT is not defined in prototypes, so some functions in ds.js are not working. Simplest workaround (possibly the only and most simple bugfix) is to define it in prototypes like this: