mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(core): improve global variable detection (#28679)
Closes #16545 PR Close #28679
This commit is contained in:
@@ -143,15 +143,9 @@
|
||||
{
|
||||
"name": "ViewEncapsulation"
|
||||
},
|
||||
{
|
||||
"name": "__self"
|
||||
},
|
||||
{
|
||||
"name": "__values"
|
||||
},
|
||||
{
|
||||
"name": "__window"
|
||||
},
|
||||
{
|
||||
"name": "_currentNamespace"
|
||||
},
|
||||
@@ -329,6 +323,9 @@
|
||||
{
|
||||
"name": "getElementDepthCount"
|
||||
},
|
||||
{
|
||||
"name": "getGlobal"
|
||||
},
|
||||
{
|
||||
"name": "getHighestElementOrICUContainer"
|
||||
},
|
||||
|
||||
@@ -116,15 +116,9 @@
|
||||
{
|
||||
"name": "ViewEncapsulation"
|
||||
},
|
||||
{
|
||||
"name": "__self"
|
||||
},
|
||||
{
|
||||
"name": "__values"
|
||||
},
|
||||
{
|
||||
"name": "__window"
|
||||
},
|
||||
{
|
||||
"name": "_global"
|
||||
},
|
||||
@@ -239,6 +233,9 @@
|
||||
{
|
||||
"name": "getDirectiveDef"
|
||||
},
|
||||
{
|
||||
"name": "getGlobal"
|
||||
},
|
||||
{
|
||||
"name": "getHighestElementOrICUContainer"
|
||||
},
|
||||
|
||||
@@ -278,18 +278,12 @@
|
||||
{
|
||||
"name": "__read"
|
||||
},
|
||||
{
|
||||
"name": "__self"
|
||||
},
|
||||
{
|
||||
"name": "__spread"
|
||||
},
|
||||
{
|
||||
"name": "__values"
|
||||
},
|
||||
{
|
||||
"name": "__window"
|
||||
},
|
||||
{
|
||||
"name": "_c0"
|
||||
},
|
||||
@@ -680,6 +674,9 @@
|
||||
{
|
||||
"name": "getErrorLogger"
|
||||
},
|
||||
{
|
||||
"name": "getGlobal"
|
||||
},
|
||||
{
|
||||
"name": "getHighestElementOrICUContainer"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {global} from '../../src/util/global';
|
||||
|
||||
// Not yet available in TypeScript: https://github.com/Microsoft/TypeScript/pull/29332
|
||||
declare var globalThis: any /** TODO #9100 */;
|
||||
|
||||
{
|
||||
describe('global', () => {
|
||||
it('should be global this value', () => {
|
||||
const _global = new Function('return this')();
|
||||
expect(global).toBe(_global);
|
||||
});
|
||||
|
||||
if (typeof globalThis !== 'undefined') {
|
||||
it('should use globalThis as global reference', () => { expect(global).toBe(globalThis); });
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user