diff --git a/blockly_uncompressed.js b/blockly_uncompressed.js index c5a1a3ba4..8508a87fc 100644 --- a/blockly_uncompressed.js +++ b/blockly_uncompressed.js @@ -1586,6 +1586,11 @@ delete this.BLOCKLY_DIR; delete this.BLOCKLY_BOOT; }; +if (typeof DOMParser == 'undefined' && typeof require == 'function') { + // Node.js needs DOMParser loaded separately. + var DOMParser = require('xmldom').DOMParser; +} + // Delete any existing Closure (e.g. Soy's nogoog_shim). document.write(''); // Load fresh Closure Library. diff --git a/build.py b/build.py index 93269d768..96bd561a1 100755 --- a/build.py +++ b/build.py @@ -132,6 +132,11 @@ delete this.BLOCKLY_DIR; delete this.BLOCKLY_BOOT; }; +if (typeof DOMParser == 'undefined' && typeof require == 'function') { + // Node.js needs DOMParser loaded separately. + var DOMParser = require('xmldom').DOMParser; +} + // Delete any existing Closure (e.g. Soy's nogoog_shim). document.write(''); // Load fresh Closure Library.