The ECMAScript specification goes into detail about what happens when control enters the execution context of a function within a function.
function foo() {
function bar() {
}
bar(); // Control will be given to the bar function. Details specified by spec
}
There also is an explanation of what happens when control enters global code.
<script>
// Entering global code! Details specified by spec
</script>
However, there is nothing specifying what happens when entering control for a function defined in the global code.
<script>
function foo() {
}
foo(); // Calling a function defined in the global environment...not specified by spec
</script>
Edit: The reason this is important to me is because I'm curious what the internal [[Scope]] property of the function called by the global code will be. I assume it will be the lexical environment of the global execution context, but there's nothing that specifies this in the specification.