mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
* chore(deps): bump jsdom from 15.2.1 to 20.0.2
Bumps [jsdom](https://github.com/jsdom/jsdom) from 15.2.1 to 20.0.2.
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md)
- [Commits](https://github.com/jsdom/jsdom/compare/15.2.1...20.0.2)
---
updated-dependencies:
- dependency-name: jsdom
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* fix(deps): Import jsdom correctly
Use the JSDOM constructor to create a JSDOM instance and then
obtain the needed polyfills from that instances .window property.
* chore(tests): Revert "Updates dependabot to ignore jsdom changes (#4777)"
This reverts commit be1dcb4b94.
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
27 lines
769 B
JavaScript
27 lines
769 B
JavaScript
/**
|
|
* @license
|
|
* Copyright 2019 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview Blockly core module for Node. It includes blockly-node.js
|
|
* and adds a helper method for setting the locale.
|
|
*/
|
|
|
|
/* eslint-disable */
|
|
'use strict';
|
|
|
|
|
|
// Override textToDomDocument and provide Node.js alternatives to DOMParser and
|
|
// XMLSerializer.
|
|
if (typeof globalThis.document !== 'object') {
|
|
const {JSDOM} = require('jsdom');
|
|
const {window} = new JSDOM(`<!DOCTYPE html>`);
|
|
globalThis.DOMParser = window.DOMParser;
|
|
globalThis.XMLSerializer = window.XMLSerializer;
|
|
const xmlDocument = Blockly.utils.xml.textToDomDocument(
|
|
`<xml xmlns="${Blockly.utils.xml.NAME_SPACE}"></xml>`);
|
|
Blockly.utils.xml.setDocument(xmlDocument);
|
|
}
|