How to use the global/document.createTextNode function in global

To help you get started, we’ve selected a few global 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 ghcjs / ghcjs-vdom / virtual-dom / lib.js View on Github external
function HSMount(domNode) {
  this._key       = ++VRenderableN;
  // this.version    = 0;
  this.vnode      = new VText(""); // currently rendered vdom tree
  this.pending    = [];            // pending patches, not yet applied
  this.node       = document.createTextNode("");
  this.parentNode = domNode;
}
github wooorm / checkmoji / src / index.js View on Github external
$img = doc.createElement('img')

    if (info) {
      $img.title = info.title + ' (on ' + platforms[pid] + ')'
      $img.alt = emoji
      $img.src = './image/' + pid + '/' + info.id + '.png'
      $dd.appendChild($img)
    } else {
      console.log('else:', info, emoji)
    }

    lastIndex = regex.lastIndex
  }

  if (lastIndex !== value.length) {
    $dd.appendChild(doc.createTextNode(value.slice(lastIndex)))
  }

  $output.appendChild(doc.createElement('dt')).textContent = platforms[pid]
  $output.appendChild($dd)

  regex.lastIndex = 0
}
github lukeburns / morphable / bundle.js View on Github external
for (var i = 0; i < childs.length; i++) {
        var node = childs[i];
        if (Array.isArray(node)) {
          yoyoifyAppendChild(el, node);
          continue;
        }
        if (typeof node === 'number' || typeof node === 'boolean' || node instanceof Date || node instanceof RegExp) {
          node = node.toString();
        }
        if (typeof node === 'string') {
          if (/^[\n\r\s]+$/.test(node)) continue;
          if (el.lastChild && el.lastChild.nodeName === '#text') {
            el.lastChild.nodeValue += node;
            continue;
          }
          node = document.createTextNode(node);
        }
        if (node && node.nodeType) {
          el.appendChild(node);
        }
      }
    };
  }, {}] }, {}, [3]);
github fathomlabs / open-retractions / bundle.js View on Github external
}

      if (typeof node === 'number' ||
        typeof node === 'boolean' ||
        typeof node === 'function' ||
        node instanceof Date ||
        node instanceof RegExp) {
        node = node.toString()
      }

      if (typeof node === 'string') {
        if (el.lastChild && el.lastChild.nodeName === '#text') {
          el.lastChild.nodeValue += node
          continue
        }
        node = document.createTextNode(node)
      }

      if (node && node.nodeType) {
        el.appendChild(node)
      }
    }
  }
  appendChild(children)
github ghcjs / ghcjs-vdom / virtual-dom / lib.js View on Github external
HSComponent.prototype.init = function() {
  var n = document.createTextNode('');
  if(this.vnode !== this.initialVnode) {
    var thunks = [];
    var p = diff(this.initialVnode, this.vnode, thunks);
    if(thunks.length !== 0) {
      throw new Error("HSComponent vnode contains unevaluated thunks");
    }
    n = vdomPatch(n, p);
  }
  var m = new HSComponentMount(n);
  n._key = m._key;
  n._widget = this;
  this.mounts[m._key] = m;
  if(this.hsMount) {
    h$vdomMountComponentCallback(this.hsMount, m._key, this);
  }
  return n;
github keplergl / kepler.gl / src / utils / dom-to-image.js View on Github external
return fontFaces.resolveAll().then((cssText) => {
    const styleNode = document.createElement('style');
    node.appendChild(styleNode);
    styleNode.appendChild(document.createTextNode(cssText));
    return node;
  });
}
github Raynos / jsonml-stringify / example / render-observ.js View on Github external
function renderObserv(jsonml) {
	jsonml = normalize(jsonml)

	if (jsonml === null) {
        return null
    } else if (typeof jsonml === "string") {
        return document.createTextNode(jsonml)
    } else if (!!jsonml && typeof jsonml.raw === "string") {
        return element(jsonml.raw)
    } else if (!!jsonml && Array.isArray(jsonml.fragment)) {
        var frag = document.createDocumentFragment()
        jsonml.fragment.forEach(function (child) {
            frag.appendChild(renderObserv(child))
        })
        return frag
    } else if (typeof jsonml === "function") {
    	var elem = renderObserv(jsonml())
    	var elems = []

    	if (elem === null) {
    		elem = placeholder()
    	}
github Raynos / jsonml-stringify / examples / lib / plugin-either.js View on Github external
function placeholder() {
    return document.createTextNode("")
}
github wayfair / tungstenjs / src / debug / window_manager.js View on Github external
button.style.padding = '6px 10px';
    button.style.cursor = 'pointer';
    button.style.borderRadius = '3px';
    button.style.boxShadow = 'rgba(255, 255, 255, 0.2) 4px 3px 1px inset, rgba(0, 0, 0, 0.4) 2px 2px 3px';
    button.style.fontWeight = 'bold';
    button.style.fontSize = '42px';
    button.style.color = '#FFF';
    button.style.textShadow = '0 -1px 0px #000';
    button.style.background = '#995CA3';
    button.style.position = 'absolute';
    button.style.left = '25%';
    button.style.top = '30%';
    button.style.width = '50%';
    button.style.height = '40%';

    var buttonText = document.createTextNode('Open Tungsten.js Debugger');
    button.appendChild(buttonText);
    overlay.appendChild(button);
    document.body.appendChild(overlay);

    utils.addEventListener(button, 'click', function() {
      launchDebugger();
    });

    utils.addEventListener(overlay, 'click', function() {
      document.body.removeChild(overlay);
    });
  }
};