Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.parserVars =
{
// Parse session variables
elementStack: [],
htmlBase: {},
linkCount: 0,
linkElementStack: [],
// Per-link variables
links: [],
selector: "",
voidElement: false
};
this.parser = new parse5.SimpleApiParser(
{
startTag: function(tagName, attrs, selfClosing)
{
handler_startTag(thisObj, tagName, attrs, selfClosing);
},
endTag: function(tagName)
{
handler_endTag(thisObj, tagName);
},
text: function(text)
{
handler_text(thisObj, text);
}
});
}
function htmlParser ( str, filepath ) {
var comments = [],
parse5Parser = new parse5.SimpleApiParser({
comment: function ( str ) {
comments.push( translator.translate( str ) );
}
});
// send our view through the parser
parse5Parser.parse( str );
return { err: null, data: { comments: comments } };
}
function modify(value, options) {
var modifiedValue = '',
parser;
parser = new SimpleApiParser({
/**
* @param {String} name
* @param {String} publicId
* @param {String} systemId
*/
doctype: function (name, publicId, systemId) {
modifiedValue += serialize.doctype(name, publicId, systemId);
},
/**
* @param {String} tagName
* @param {Array} attrs
* @param {Boolean} selfClosing
*/
startTag: function (tagName, attrs, selfClosing) {
if (options.ignoreDuplicateAttributes) {
attrs = utils.removeDuplicateAttributes(attrs);
apply: function(content) {
var
parser,
output = '';
parser = new parse5.SimpleApiParser({
doctype: function(name, publicId, systemId) {
var
doctype;
doctype = '';
output += doctype;
},
startTag: function(tag, attrs, unary) {
var Pipeline = module.exports = function () {
this.plugins = [ContextPlugin];
this.pluginInitArgs = {};
var pipeline = this;
//NOTE: we don't use .bind() here because it uses quite slow .apply() internally.
this.parser = new parse5.SimpleApiParser({
doctype: function (name, publicId, systemId) {
pipeline.onDoctype({
name: name,
publicId: publicId,
systemId: systemId
});
},
startTag: function (tagName, attrs, selfClosing) {
pipeline.onStartTag({
tagName: tagName,
attrs: attrs,
selfClosing: selfClosing
});
},
var Scraper = function () {
this.extractors = [];
this.charsetEncoding = null;
this.baseTagFound = false;
this.commonState = {
baseUrl: null,
inElement: null,
inBody: false
};
var scrapper = this;
//NOTE: we don't use bind() here because it uses quite slow .apply() internally.
this.parser = new parse5.SimpleApiParser({
doctype: function (name, publicId, systemId) {
scrapper._onDoctype(name, publicId, systemId);
},
startTag: function (tagName, attrs, selfClosing) {
scrapper._onStartTag(tagName, attrs, selfClosing);
},
endTag: function (tagName) {
scrapper._onEndTag(tagName);
},
text: function (text) {
scrapper._onText(text);
},