es6-shim
es6-shim copied to clipboard
IE10 and others: DataView missing prototypes and getters
IE10's DataView does not appear to be ES6 compliant. It's listed as being compatible on MDN. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView/byteOffset
try {
console.log(DataView.prototype.buffer);
} catch (e) {
console.log(e);
}
try {
console.log(DataView.prototype.byteLength);
} catch (e) {
console.log(e);
}
try {
console.log(DataView.prototype.byteOffset);
} catch (e) {
console.log(e);
}
var a = Object.getPrototypeOf(new DataView(new ArrayBuffer(4)));
console.log(a);
var x = Object.getOwnPropertyDescriptor(a, 'byteLength').get;
console.log(x);
console.log(x.call(new DataView(new ArrayBuffer(4))));
http://jsfiddle.net/Xotic750/08zng894/3/
Opera 12.16, also listed in MDN, also seems to have similar problems. Safari 5.1, listed in MDN, also seems the same. Chrome 26, similar. FireFox 15, also.
Currently the es6-shim doesn't attempt to detect, patch, or implement anything relating to Typed Arrays, including ArrayBuffer and DataView.
Hopefully some day though, huh?
Possibly never - their sole use case is for performance, and you can't get that performance without native support.
Hmm. This forces me to rethink my isArrayBuffer/isDataView routines. I changed them to to detect ES6 Arraybuffers (which they do just fine), and if es6-shim can't or has no plan on fixing such issues with these legacy implementations then I'm back to the "when is an ArrayBuffer not" dilemma. :/
I can't think of a simple way to fix the deficiencies anyhow.