1 <p>This page tests issues of scope with nested functions.
</p>
2 <pre id=
"console"></pre>
7 document
.getElementById("console").appendChild(document
.createTextNode(s
+ "\n"));
10 function shouldBe(evalA
, a
, b
)
13 log("PASS: " + a
+ " should be " + b
+ " and is.");
15 log("FAIL: " + a
+ " should be " + b
+ " but instead is " + evalA
+ ".");
19 if (window
.testRunner
)
20 testRunner
.dumpAsText();
22 log("Before parsing f:");
24 shouldBe(typeof f
, "typeof f", "function");
25 shouldBe(typeof f
.f1
, "typeof f.f1", "undefined");
30 log("\nIn call to f:");
32 shouldBe(typeof f
, "typeof f", "function");
33 shouldBe(typeof f1
, "typeof f1", "function");
34 shouldBe(typeof f
.f1
, "typeof f.f1", "undefined");
35 shouldBe(typeof x
, "typeof x", "number");
36 shouldBe(typeof y
, "typeof y", "undefined");
43 log("\nAfter parsing f, but before calling f:");
45 shouldBe(typeof f
, "typeof f", "function");
46 shouldBe(typeof f
.f1
, "typeof f.f1", "undefined");