Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1913)

Unified Diff: node_modules/vulcanize/node_modules/whacko/node_modules/parse5/lib/jsdom/jsdom_parser.js

Issue 800513006: Added vulcanize under third_party/npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: node_modules/vulcanize/node_modules/whacko/node_modules/parse5/lib/jsdom/jsdom_parser.js
diff --git a/node_modules/vulcanize/node_modules/whacko/node_modules/parse5/lib/jsdom/jsdom_parser.js b/node_modules/vulcanize/node_modules/whacko/node_modules/parse5/lib/jsdom/jsdom_parser.js
new file mode 100644
index 0000000000000000000000000000000000000000..b318d8e01cc48bd588392b97612a73a0092f2c8f
--- /dev/null
+++ b/node_modules/vulcanize/node_modules/whacko/node_modules/parse5/lib/jsdom/jsdom_parser.js
@@ -0,0 +1,39 @@
+'use strict';
+
+var Parser = require('../tree_construction/parser'),
+ ParsingUnit = require('./parsing_unit');
+
+//API
+exports.parseDocument = function (html, treeAdapter) {
+ //NOTE: this should be reentrant, so we create new parser here
+ var parser = new Parser(treeAdapter),
+ parsingUnit = new ParsingUnit(parser);
+
+ //NOTE: override parser loop method
+ parser._runParsingLoop = function () {
+ parsingUnit.parsingLoopLock = true;
+
+ while (!parsingUnit.suspended && !this.stopped)
+ this._iterateParsingLoop();
+
+ parsingUnit.parsingLoopLock = false;
+
+ if (this.stopped)
+ parsingUnit.callback(this.document);
+ };
+
+ //NOTE: wait while parserController will be adopted by calling code, then
+ //start parsing
+ process.nextTick(function () {
+ parser.parse(html);
+ });
+
+ return parsingUnit;
+};
+
+exports.parseInnerHtml = function (innerHtml, contextElement, treeAdapter) {
+ //NOTE: this should be reentrant, so we create new parser here
+ var parser = new Parser(treeAdapter);
+
+ return parser.parseFragment(innerHtml, contextElement);
+};

Powered by Google App Engine
This is Rietveld 408576698