Relationship between globals, Realms, and global environment records

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Nov 25 09:51:24 PST 2014


On Nov 25, 2014, at 8:53 AM, Anne van Kesteren wrote:

> On Tue, Nov 25, 2014 at 5:45 PM, Allen Wirfs-Brock
> <allen at wirfs-brock.com> wrote:
>> I'm simply trying to understand what what is meant when HTML talks about changing the global object/realm/etc.
> 
> onload = function() {
>  self.x = "test"
>  console.log(self.x) // "test"
>  document.open("text/html")
>  console.log(self.x) // undefined
> }
> 

This example does tell me anything useful because 'self' is just a upbinding of the function.

Even if I assume that 'self' is a property of the global object, the example isn't interesting because the open function, if it was created in the same Realm as the function, would also have access to the same global object and could modify the object that is the value of its 'self' property.

Allen


More information about the es-discuss mailing list