Open
Description
What started as a problem of Uint8Array is Blob. #1014
The following is the test code, please help to answer it:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test</title>
</head>
<body>
<!-- No error is reported if it is not imported -->
<script src="https://www.unpkg.com/core-js-bundle@3.30.1/minified.js"></script>
<script>
var str = 'hello world';
var n = str.length;
var uiArr = new Uint8Array(n);
for (var i = 0; i < n; i++) {
uiArr[i] = str.charCodeAt(i);
}
console.log(uiArr);
console.log(new Blob([uiArr])); // in ie10 throw error: InvalidStateError
</script>
</body>
</html>
Activity
zloirock commentedon Apr 22, 2023
Yes, this is an issue. In IE10 and some early IE11 versions,
core-js
is forced to completely reimplement typed arrays - and nativeBlob
and some other features do not properly work with polyfilled typed arrays.I'm not sure what should
core-js
do in this case since adding workarounds for all possible cases is problematic.I'll think about what can be done - maybe it makes sense to add a wrapper / workaround for
Blob
, maybe not.