mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
chore: Remove Blockly.utils.global (#6120)
The Closure Compiler creates globalThis as a pollyfill.
This commit is contained in:
@@ -21,12 +21,11 @@ Blockly.setLocale = function (locale) {
|
||||
|
||||
// Override textToDomDocument and provide Node.js alternatives to DOMParser and
|
||||
// XMLSerializer.
|
||||
const globalThis = Blockly.utils.global;
|
||||
if (typeof globalThis.document !== 'object') {
|
||||
const jsdom = require('jsdom/lib/jsdom/living');
|
||||
globalThis.DOMParser = jsdom.DOMParser;
|
||||
globalThis.XMLSerializer = jsdom.XMLSerializer;
|
||||
const xmlDocument = Blockly.utils.xml.textToDomDocument(
|
||||
`<xml xmlns="${Blockly.utils.xml.NAME_SPACE}"></xml>`);
|
||||
`<xml xmlns="${Blockly.utils.xml.NAME_SPACE}"></xml>`);
|
||||
Blockly.utils.xml.setDocument(xmlDocument);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user