Index: node_modules/vulcanize/node_modules/whacko/node_modules/parse5/lib/jsdom/parsing_unit.js |
diff --git a/node_modules/vulcanize/node_modules/whacko/node_modules/parse5/lib/jsdom/parsing_unit.js b/node_modules/vulcanize/node_modules/whacko/node_modules/parse5/lib/jsdom/parsing_unit.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..852efa888244892781c2d96aed1982e3c58c9e84 |
--- /dev/null |
+++ b/node_modules/vulcanize/node_modules/whacko/node_modules/parse5/lib/jsdom/parsing_unit.js |
@@ -0,0 +1,53 @@ |
+'use strict'; |
+ |
+var ParsingUnit = module.exports = function (parser) { |
+ this.parser = parser; |
+ this.suspended = false; |
+ this.parsingLoopLock = false; |
+ this.callback = null; |
+}; |
+ |
+ParsingUnit.prototype._stateGuard = function (suspend) { |
+ if (this.suspended && suspend) |
+ throw new Error('parse5: Parser was already suspended. Please, check your control flow logic.'); |
+ |
+ else if (!this.suspended && !suspend) |
+ throw new Error('parse5: Parser was already resumed. Please, check your control flow logic.'); |
+ |
+ return suspend; |
+}; |
+ |
+ParsingUnit.prototype.suspend = function () { |
+ this.suspended = this._stateGuard(true); |
+ |
+ return this; |
+}; |
+ |
+ParsingUnit.prototype.resume = function () { |
+ this.suspended = this._stateGuard(false); |
+ |
+ //NOTE: don't enter parsing loop if it is locked. Without this lock _runParsingLoop() may be called |
+ //while parsing loop is still running. E.g. when suspend() and resume() called synchronously. |
+ if (!this.parsingLoopLock) |
+ this.parser._runParsingLoop(); |
+ |
+ return this; |
+}; |
+ |
+ParsingUnit.prototype.documentWrite = function (html) { |
+ this.parser.tokenizer.preprocessor.write(html); |
+ |
+ return this; |
+}; |
+ |
+ParsingUnit.prototype.handleScripts = function (scriptHandler) { |
+ this.parser.scriptHandler = scriptHandler; |
+ |
+ return this; |
+}; |
+ |
+ParsingUnit.prototype.done = function (callback) { |
+ this.callback = callback; |
+ |
+ return this; |
+}; |