From 823db83b1989a07ff3640b8d9c837dd08997132a Mon Sep 17 00:00:00 2001 From: Tim de Koning Date: Wed, 27 Jun 2012 11:05:17 +0200 Subject: [PATCH] Fixed Safari / Iphone / Ipad support further --- web/compatibility.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/web/compatibility.js b/web/compatibility.js index 528841bb6..39580ef2a 100644 --- a/web/compatibility.js +++ b/web/compatibility.js @@ -6,6 +6,16 @@ // Checking if the typed arrays are supported (function checkTypedArrayCompatibility() { if (typeof Uint8Array !== 'undefined') { + // some mobile versions do not support subarray (e.g. safari 5 / iPhone / iPad) + if (typeof Uint8Array.prototype.subarray === 'undefined') { + Uint8Array.prototype.subarray = function subarray(start, end) { + return new Uint8Array(this.slice(start, end)); + } + Float32Array.prototype.subarray = function subarray(start, end) { + return new Float32Array(this.slice(start, end)); + } + } + // some mobile version might not support Float64Array if (typeof Float64Array === 'undefined') window.Float64Array = Float32Array; @@ -69,7 +79,8 @@ // Object.defineProperty() ? (function checkObjectDefinePropertyCompatibility() { - if (typeof Object.defineProperty !== 'undefined') + // safari 5 cannot use this on DOM objects and thus is unusable, see http://kangax.github.com/es5-compat-table/ + if ((typeof Object.defineProperty !== 'undefined') && /Safari\/5/.test(navigator.userAgent)) return; Object.defineProperty = function objectDefineProperty(obj, name, def) {