forked from tautologistics/node-htmlparser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed slow parsing caused by too many backtracking
fixes tautologistics#61
- Loading branch information
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
(function () { | ||
|
||
function RunningInNode () { | ||
return( | ||
(typeof require) == "function" | ||
&& | ||
(typeof exports) == "object" | ||
&& | ||
(typeof module) == "object" | ||
&& | ||
(typeof __filename) == "string" | ||
&& | ||
(typeof __dirname) == "string" | ||
); | ||
} | ||
|
||
if (!RunningInNode()) { | ||
if (!this.Tautologistics) | ||
this.Tautologistics = {}; | ||
if (!this.Tautologistics.NodeHtmlParser) | ||
this.Tautologistics.NodeHtmlParser = {}; | ||
if (!this.Tautologistics.NodeHtmlParser.Tests) | ||
this.Tautologistics.NodeHtmlParser.Tests = []; | ||
exports = {}; | ||
this.Tautologistics.NodeHtmlParser.Tests.push(exports); | ||
} | ||
|
||
exports.name = "Bug 61"; | ||
exports.options = { | ||
handler: {} | ||
, parser: {} | ||
}; | ||
exports.html = new Array(300000).join("\t") + "<"; | ||
exports.chunkSize = 500; | ||
exports.expected = | ||
[ { raw: exports.html.substr(0,exports.html.length-1) | ||
, data: exports.html.substr(0,exports.html.length-1) | ||
, type: 'text' | ||
} | ||
]; | ||
|
||
})(); |