Fix DOMParser in node.js

This commit is contained in:
Neil Fraser 2015-06-04 12:27:35 -07:00
parent 9c1e8588ba
commit b935dd8613
2 changed files with 10 additions and 0 deletions

View file

@ -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('<script>var goog = undefined;</script>');
// Load fresh Closure Library.

View file

@ -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('<script>var goog = undefined;</script>');
// Load fresh Closure Library.