How to use the domelementtype.Comment function in domelementtype

To help you get started, we’ve selected a few domelementtype examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JpEncausse / WSRNodeJS / script / vendor / cheerio / node_modules / htmlparser2 / node_modules / domhandler / index.js View on Github external
DomHandler.prototype.oncomment = function(data){
	var lastTag = this._tagStack[this._tagStack.length - 1];

	if(lastTag && lastTag.type === ElementType.Comment){
		lastTag.data += data;
		return;
	}

	var element = {
		data: data,
		type: ElementType.Comment
	};

	this._addDomElement(element);
	this._tagStack.push(element);
};
github neftjs / neft / Element / impls / htmlparser / stringify.js View on Github external
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){
github andrewshawcare / thoughtworks-email-signature-generator / node_modules / grunt-contrib-jshint / node_modules / jshint / node_modules / htmlparser2 / node_modules / domhandler / index.js View on Github external
DomHandler.prototype.oncomment = function(data){
	var lastTag = this._tagStack[this._tagStack.length - 1];

	if(lastTag && lastTag.type === ElementType.Comment){
		lastTag.data += data;
		return;
	}

	var element = {
		data: data,
		type: ElementType.Comment
	};

	this._addDomElement(element);
	this._tagStack.push(element);
};
github davidhealey / waistline / node_modules / domhandler / index.js View on Github external
DomHandler.prototype.oncomment = function(data){
	var lastTag = this._tagStack[this._tagStack.length - 1];

	if(lastTag && lastTag.type === ElementType.Comment){
		lastTag.data += data;
		return;
	}

	var element = {
		data: data,
		type: ElementType.Comment
	};

	this._addDomElement(element);
	this._tagStack.push(element);
};
github kuhnza / cheerio-repl / node_modules / cheerio / node_modules / htmlparser2 / node_modules / domhandler / index.js View on Github external
DomHandler.prototype.oncomment = function(data){
	var lastTag = this._tagStack[this._tagStack.length - 1];

	if(lastTag && lastTag.type === ElementType.Comment){
		lastTag.data += data;
		return;
	}

	var element = {
		data: data,
		type: ElementType.Comment
	};

	this._addDomElement(element);
	this._tagStack.push(element);
};
github csxiaoyaojianxian / JavaScriptStudy / 09-Tools / 01-webpack / node_modules / domhandler / index.js View on Github external
DomHandler.prototype.oncomment = function(data){
	var lastTag = this._tagStack[this._tagStack.length - 1];

	if(lastTag && lastTag.type === ElementType.Comment){
		lastTag.data += data;
		return;
	}

	var element = {
		data: data,
		type: ElementType.Comment
	};

	this._addDomElement(element);
	this._tagStack.push(element);
};
github victorporof / Sublime-JSHint / scripts / node_modules / domhandler / index.js View on Github external
DomHandler.prototype.oncomment = function(data){
	var lastTag = this._tagStack[this._tagStack.length - 1];

	if(lastTag && lastTag.type === ElementType.Comment){
		lastTag.data += data;
		return;
	}

	var element = {
		data: data,
		type: ElementType.Comment
	};

	this._addDomElement(element);
	this._tagStack.push(element);
};
github csxiaoyaojianxian / JavaScriptStudy / 09-Tools / 01-webpack / node_modules / domhandler / index.js View on Github external
DomHandler.prototype.oncomment = function(data){
	var lastTag = this._tagStack[this._tagStack.length - 1];

	if(lastTag && lastTag.type === ElementType.Comment){
		lastTag.data += data;
		return;
	}

	var element = {
		data: data,
		type: ElementType.Comment
	};

	this._addDomElement(element);
	this._tagStack.push(element);
};
github substance / substance / dom / _domSerializer.js View on Github external
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('')
}
github arangodb / arangodb / js / node / node_modules / jshint / node_modules / htmlparser2 / node_modules / domutils / node_modules / dom-serializer / index.js View on Github external
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;
};

domelementtype

all the types of nodes in htmlparser2's dom

BSD-2-Clause
Latest version published 3 years ago

Package Health Score

66 / 100
Full package analysis