Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
DomHandler.prototype.onprocessinginstruction = function(name, data){
this._addDomElement({
name: name,
data: data,
type: ElementType.Directive
});
};
DomHandler.prototype.onprocessinginstruction = function(name, data){
this._addDomElement({
name: name,
data: data,
type: ElementType.Directive
});
};
function render(dom, opts) {
if (!Array.isArray(dom)) dom = [dom]
opts = opts || {}
let output = []
for(var i = 0; i < dom.length; i++){
let elem = dom[i]
if (elem.type === 'root') {
output.push(render(elem.childNodes, opts))
} else if (ElementType.isTag(elem)) {
output.push(renderTag(elem, opts))
} else if (elem.type === ElementType.Directive) {
output.push(renderDirective(elem))
} else if (elem.type === ElementType.Comment) {
output.push(renderComment(elem))
} else if (elem.type === ElementType.CDATA) {
output.push(renderCdata(elem))
} else {
output.push(renderText(elem, opts))
}
}
return output.join('')
}
DomHandler.prototype.onprocessinginstruction = function(name, data){
this._addDomElement({
name: name,
data: data,
type: ElementType.Directive
});
};
var render = module.exports = function(dom, opts) {
if (!Array.isArray(dom) && !dom.cheerio) dom = [dom];
opts = opts || {};
var output = '';
for(var i = 0; i < dom.length; i++){
var elem = dom[i];
if (elem.type === 'root')
output += render(elem.children, opts);
else if (ElementType.isTag(elem))
output += renderTag(elem, opts);
else if (elem.type === ElementType.Directive)
output += renderDirective(elem);
else if (elem.type === ElementType.Comment)
output += renderComment(elem);
else if (elem.type === ElementType.CDATA)
output += renderCdata(elem);
else
output += renderText(elem, opts);
}
return output;
};
function getOuterHTML(elem){
if (!elem.visible) return;
switch(elem.type){
case ElementType.Text:
return elem.data;
case ElementType.Comment:
return "";
case ElementType.Directive:
return "<" + elem.data + ">";
case ElementType.CDATA:
return "";
}
if (exports.omit && ~exports.omit.indexOf(elem.name)) return getInnerHTML(elem);
var ret = "<" + elem.name;
if("attribs" in elem){
for(var attr in elem.attribs){
if(elem.attribs.hasOwnProperty(attr)){
ret += " " + attr;
var value = elem.attribs[attr];
if(value == null){
if( !(attr in booleanAttribs) ){
ret += '=""';
DomHandler.prototype.onprocessinginstruction = function(name, data){
this._addDomElement({
name: name,
data: data,
type: ElementType.Directive
});
};
DomHandler.prototype.onprocessinginstruction = function(name, data){
this._addDomElement({
name: name,
data: data,
type: ElementType.Directive
});
};
var render = (module.exports = function(dom, opts) {
if (!Array.isArray(dom) && !dom.cheerio) dom = [dom];
opts = opts || {};
var output = '';
for (var i = 0; i < dom.length; i++) {
var elem = dom[i];
if (elem.type === 'root') output += render(elem.children, opts);
else if (ElementType.isTag(elem)) output += renderTag(elem, opts);
else if (elem.type === ElementType.Directive)
output += renderDirective(elem);
else if (elem.type === ElementType.Comment) output += renderComment(elem);
else if (elem.type === ElementType.CDATA) output += renderCdata(elem);
else output += renderText(elem, opts);
}
return output;
});
DomHandler.prototype.onprocessinginstruction = function(name, data){
var element = this._createDomElement({
name: name,
data: data,
type: ElementType.Directive
});
this._addDomElement(element);
};