javascript SCRIPT1010:IE10 中的预期标识符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15632568/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 01:27:46  来源:igfitidea点击:

SCRIPT1010: Expected identifier in IE10

javascriptprototypejsinternet-explorer-10

提问by Chris

In my project I am using the Prototype JavaScript Framework 1.7.1

在我的项目中,我使用的是 Prototype JavaScript Framework 1.7.1

When I load the web page in IE10 on Windows 7 I get the error message below: SCRIPT1010: Expected identifier line 1 character 9 which points to <!DOCTYPE html>in my test HTML page below:

当我在 Windows 7 上的 IE10 中加载网页时,我收到以下错误消息:SCRIPT1010:预期标识符第 1 行字符 9 指向<!DOCTYPE html>下面我的测试 HTML 页面:

<!DOCTYPE html>
<html>
<head>
 <title>My webpage title</title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
 <meta name="description" content="" />
 <meta name="keywords" content="" />
 <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js'></script>
</head>
<body>
    just testing
</body>
</html>

HTTP Request Header

HTTP 请求头

GET /test.html HTTP/1.1[CRLF]
Host: www.mydomain.com[CRLF]
Connection: close[CRLF]
User-Agent: Web-sniffer/1.0.44 (+http://web-sniffer.net/)[CRLF]
Accept-Encoding: gzip[CRLF]
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8[CRLF]
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6[CRLF]
Accept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7[CRLF]
Cache-Control: no-cache[CRLF]
Referer: http://web-sniffer.net/[CRLF]

HTTP Response Header

HTTP 响应头

Name    Value   Delim
Status: HTTP/1.1 200 OK
Server: webhost 
Date:   Tue, 26 Mar 2013 10:07:56 GMT   
Content-Type:   text/html   
Transfer-Encoding:  chunked 
Connection: close   
Vary:   Accept-Encoding,User-Agent  
Last-Modified:  Tue, 26 Mar 2013 10:07:29 GMT   
Cache-Control:  max-age=3600, public, must-revalidate, proxy-revalidate 
Expires:    Tue, 26 Mar 2013 11:07:56 GMT   
Pragma: public  
CF-RAY: 553096521a6047f 
Content-Encoding:   gzip

Does anyone know what is causing this error or is this a bug in Prototype 1.7.1?

有谁知道是什么导致了这个错误,或者这是 Prototype 1.7.1 中的一个错误?

回答by Geek Num 88

See this pull request on Github https://github.com/sstephenson/prototype/pull/93

在 Github https://github.com/sstephenson/prototype/pull/93上查看此拉取请求

PrototypeJS does some feature detection everytime it loads and Internet Explorer 10 has adjusted the way some of the Javascript syntax is parsed and throws that error.

PrototypeJS 每次加载时都会进行一些功能检测,Internet Explorer 10 已经调整了一些 Javascript 语法的解析方式并抛出该错误。

PrototypeJS is doing a detection to see how to handle passing functions as tag attributes (like an onclick method) and the IE10 javascript parser detects that as a syntax error.

PrototypeJS 正在进行检测以查看如何将传递的函数作为标记属性(如 onclick 方法)进行处理,而 IE10 javascript 解析器将其检测为语法错误。

If you look at the pull request in Github it will show you a band-aid as well as a full fix to make Internet Explorer 10 happy.

如果您查看 Github 中的拉取请求,它会向您展示创可贴以及使 Internet Explorer 10 满意的完整修复程序。

Please spread the word.

请广而告之。

2013-05-17 UPDATEThe pull request referenced has been closed and a fix has been integrated into the the master branch of the PrototypeJS github

2013-05-17 UPDATE引用的 pull request 已关闭,并在 PrototypeJS github 的 master 分支中集成了一个修复程序

https://github.com/sstephenson/prototype

https://github.com/sstephenson/prototype

Please clone from there and update your scripts.

请从那里克隆并更新您的脚本。

2014-05-01 UPDATEThe fix for this has been released in PrototypeJS 1.7.2

2014-05-01 更新PrototypeJS 1.7.2 中已发布此修复程序

http://prototypejs.org/2014/04/18/prototype-1-7-2/

http://prototypejs.org/2014/04/18/prototype-1-7-2/