Example #1
0
  return (node, index, sideEffects) => {
    if (isNull(node) || isUndefined(node)) return

    const originNode = parentNode.childNodes[i++] || null
    const DOM = createWithSideEffects(
      node,
      createPath(path, node.key || index),
      dispatch,
      context,
      {originNode}
    )

    sideEffects.ofChildren.push(DOM.sideEffects)

    switch (DOM.action) {
      case CREATE:
        parentNode.appendChild(DOM.element)
        break
      case REPLACE:
        cache.store(parentNode.replaceChild(DOM.element, originNode))
        break
      default:
    }
  }
Example #2
0
File: create.js Project: JJVvV/deku
 children.forEach((node, index) => {
   if (isNull(node) || isUndefined(node)) return
   let childPath = createPath(path, node.key || index)
   let child = createElement(node, childPath, dispatch, context)
   DOMElement.appendChild(child)
 })
Example #3
0
 str += children.map((child, i) => renderString(
   child,
   context,
   path + '.' + (isNull(child.key) ? i : child.key),
   opts
 )).join('')