WebIDL specification can be found at https://heycam.github.io/webidl/
The specification files doesn't containts browsers global varibale scope, e.g. access to window. This can be defined with a special annotation OnGlobalScope on a interface be able to define this methods and attributes. Please note that all attributes and methods need to be defined static to get correctly compilable code.
Note: in the above example, to generator will create a function named Document() to get the document attribute. This will name clash with the interface Document. This is fixed by the language transformation file that is renaming the attribute in the final lanaguage.