Add `$document` gvar if it exists on $window