浏览器JS引擎是否实现了ECMAScript的closure?

There is a test.
var test="wrong"
Object.prototype.test
="right";

var score=0;

void function f0(){
    
if(test=="right")score++;
}()

void function(){
    
if(test=="wrong")score++;
}()

var e="right";
try{
    
throw new Error;
catch(e) {
    e
="wrong";
    
if(test=="right")score++;
}
if(e=="right")score++;

var f;
void function f(){
}
if(typeof f=="undefined")score++;


var err;
function a(){
    
var m="right";
    
var n;
    
return function(){
        
var err;
        
return arguments[0].call(this,arguments[1]);
    }
}
try{
var b=a();
if(b(eval,"m")=="right")score++;
catch(err) {
}


alert(score
+"/6")

完全实现了ECMAScript3的JS引擎应该得到 6/6
然而
InternetExplorer8.0        2/6
FireFox3.0                      5/6
Opera9.5                        4/6
Safari3.1.1                     4/6
浏览器
IE
FF
Opera
Safari






























posted @ 2008-06-25 21:03  winter-cn  阅读(795)  评论(2编辑  收藏  举报