Comparing version 2.1.3 to 2.1.4
@@ -37,2 +37,3 @@ 'use strict'; | ||
this.writeCallback = null; | ||
this.parserLoopLock = false; | ||
@@ -61,3 +62,3 @@ /** | ||
this.parser.tokenizer.write(chunk.toString('utf8'), this.lastChunkWritten); | ||
this.parser._runParsingLoop(this.writeCallback); | ||
this._runParsingLoop(); | ||
}; | ||
@@ -71,2 +72,13 @@ | ||
//Scriptable parser implementation | ||
ParserStream.prototype._runParsingLoop = function () { | ||
// NOTE: This helps avoid reentrant invocation of parsing loop | ||
// in cases then `resume` called synchronously | ||
// (see: https://github.com/inikulin/parse5/issues/98). | ||
if (!this.parserLoopLock) { | ||
this.parserLoopLock = true; | ||
this.parser._runParsingLoop(this.writeCallback); | ||
this.parserLoopLock = false; | ||
} | ||
}; | ||
ParserStream.prototype._resume = function () { | ||
@@ -86,3 +98,3 @@ if (!this.parser.pausedByScript) | ||
if (this.parser.tokenizer.active) | ||
this.parser._runParsingLoop(this.writeCallback); | ||
this._runParsingLoop(); | ||
}; | ||
@@ -132,14 +144,6 @@ | ||
var parser = this; | ||
// NOTE: emit `script` on next tick so we let parsing | ||
// loop stop spinning due to `pausedByScript` flag. | ||
// This helps avoid reentrant invocation of parsing loop | ||
// in cases then `resume` called synchronously | ||
// (see: https://github.com/inikulin/parse5/issues/98). | ||
process.nextTick(function () { | ||
parser.emit('script', scriptElement, parser._documentWrite, parser._resume); | ||
}); | ||
this.emit('script', scriptElement, this._documentWrite, this._resume); | ||
} | ||
}; | ||
{ | ||
"name": "parse5", | ||
"description": "WHATWG HTML5 specification-compliant, fast and ready for production HTML parsing/serialization toolset for Node.js", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"author": "Ivan Nikulin <ifaaan@gmail.com> (https://github.com/inikulin)", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7407
380929