({ 
  'foo': 20, 
  'test': function () { 
    var f = function () { 
      alert("foo:"+ foo);
      alert("this.foo:"+ this.foo);
      alert("bar:"+ bar);
    } 
    with (this) { 
      var foo = 42; 
      var bar = 21; 
      f.call(this); 
    } 
  } 
}).test();

--

By my reading, `foo` and `bar` are declared and initialized in `test`, and 
closed over by `f`.  I expect to see:

foo:42
this.foo:20
bar:21

But in Rhino, Firefox, Safari and Opera I am seeing:

foo:undefined
this.foo:42
bar:21

Flash 10 gives me the answer I expected.  I have not tested other JS engines.


_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to