问题
I am having issues with a site build where the page is not displaying properly in IE11. The site displays correctly in chrome, firefox, and edge.
The error seems to break all the javascript from the file of the error. The file is responsible for handling parts of the layout, so when it fails it causes various sections on the page to not render properly.
The error message is "Script1010" and points to the following line of code:
function animate({ draw, duration }) {
...
}
I've not been able to identify why IE cannot process this line. The closest thing to answer I've seen is the following post that suggests that "draw" or "duration" might be reserved words in IE. But changing them caused the same error to occur.
Any suggestions or pointers?
EDIT: Thanks for the replies. Figured I would clarify the question as a foot note for similar searches, or even just for myself. As pointed out below, the question boils down to "Does IE support ES6 object destructuring?". Turns out object destructuring does not work in IE.
回答1:
You are using ES6 to destructure the arguments. Internet Explorer does not support ES6.
You'll either have to rewrite it using ES5 or use a transpiler like Babel to transpile your code into ES5.
EDIT: If this is the only occurrence of ES6, I'd suggest rewriting it, but otherwise I'd use Babel.
function animate(arg) {
var draw = arg.draw
var duration = arg.duration
...
}
来源:https://stackoverflow.com/questions/53198577/function-animate-draw1-duration1-causes-expected-identifier-script10