How to use the domelementtype.Style 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 broadly / css-inliner / lib / append_rules.js View on Github external
module.exports = function appendRules(context) {
  const dom       = context.dom;
  const rules     = context.rules;
  const compress  = context.compress;

  if (rules && rules.size) {

    const css = stringifyRules(rules, compress);
    const styleElement  = {
      type:     ElementType.Style,
      name:     'style',
      attribs:  {},
      children: []
    };
    DOMUtils.appendChild(styleElement, {
      type: ElementType.Text,
      data: css
    });

    const head = DOMUtils.getElementsByTagName('head', dom, true, 2)[0];
    if (head)
      if (head.children)
        DOMUtils.prepend(head.children[0], styleElement);
      else
        DOMUtils.appendChild(head, styleElement);
    else {
github gauravshiralkar / Intuitive-Predictions-EHR / node_modules / mysql / node_modules / readable-stream / node_modules / string_decoder / build / node_modules / cheerio / node_modules / htmlparser2 / node_modules / domhandler / index.js View on Github external
DomHandler.prototype.onopentag = function(name, attribs){
	var element = {
		type: name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag,
		name: name,
		attribs: attribs,
		children: []
	};

	this._addDomElement(element);

	this._tagStack.push(element);
};

domelementtype

all the types of nodes in htmlparser2's dom

BSD-2-Clause
Latest version published 2 years ago

Package Health Score

65 / 100
Full package analysis