From 07af00f5b7731cd060cc8439f428343843c7d02e Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Thu, 26 Oct 2023 17:19:42 +0000 Subject: [PATCH] fix: replace `global` with `globalThis` This improves compatibility with cloudflare workers. --- lib/Element.js | 4 ++-- lib/config.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Element.js b/lib/Element.js index cc2f525..0b481d2 100644 --- a/lib/Element.js +++ b/lib/Element.js @@ -1101,8 +1101,8 @@ AttributesArray.prototype = Object.create(NamedNodeMap.prototype, { // We can't make direct array access work (without Proxies, node >=6) // but we can make `Array.from(node.attributes)` and for-of loops work. -if (global.Symbol && global.Symbol.iterator) { - AttributesArray.prototype[global.Symbol.iterator] = function() { +if (globalThis.Symbol?.iterator) { + AttributesArray.prototype[globalThis.Symbol.iterator] = function() { var i=0, n=this.length, self=this; return { next: function() { diff --git a/lib/config.js b/lib/config.js index abd3475..559a847 100644 --- a/lib/config.js +++ b/lib/config.js @@ -4,4 +4,4 @@ * you call `require("domino")`. */ -exports.isApiWritable = !global.__domino_frozen__; +exports.isApiWritable = !globalThis.__domino_frozen__;