es6-shim icon indicating copy to clipboard operation
es6-shim copied to clipboard

IE10 and others: DataView missing prototypes and getters

Open Xotic750 opened this issue 9 years ago • 5 comments

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/

Xotic750 avatar Dec 13 '15 20:12 Xotic750

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.

Xotic750 avatar Dec 13 '15 20:12 Xotic750

Currently the es6-shim doesn't attempt to detect, patch, or implement anything relating to Typed Arrays, including ArrayBuffer and DataView.

ljharb avatar Dec 14 '15 00:12 ljharb

Hopefully some day though, huh?

Xotic750 avatar Dec 14 '15 00:12 Xotic750

Possibly never - their sole use case is for performance, and you can't get that performance without native support.

ljharb avatar Dec 14 '15 01:12 ljharb

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.

Xotic750 avatar Dec 14 '15 08:12 Xotic750