Use globalThis to reference global scope (#3719)

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
Kitson Kelly 2020-01-21 01:30:30 +11:00 committed by Ry Dahl
parent 23e67eb515
commit 60b53fd6b6
19 changed files with 219 additions and 264 deletions

View file

@ -1,7 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { DomIterable } from "../dom_types.ts";
import { window } from "../window.ts";
import { requiredArguments } from "../util.ts";
import { exposeForTest } from "../internals.ts";
@ -57,7 +56,9 @@ export function DomIterableMixin<K, V, TBase extends Constructor>(
arguments.length,
1
);
callbackfn = callbackfn.bind(thisArg == null ? window : Object(thisArg));
callbackfn = callbackfn.bind(
thisArg == null ? globalThis : Object(thisArg)
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
for (const [key, value] of (this as any)[dataSymbol]) {
callbackfn(value, key, this);