Exemple #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:
    }
  }
Exemple #2
0
 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)
 })
Exemple #3
0
 str += children.map((child, i) => renderString(
   child,
   context,
   path + '.' + (isNull(child.key) ? i : child.key),
   opts
 )).join('')