function replaceNode (value, previousValue, i) {
    var activeNode = activeNodes[i]
    var currentNode = node
    var returnValue

    // Cast values to null if undefined.
    if (value === void 0) value = null
    if (previousValue === void 0) previousValue = null

    // If value is null, just remove the Node.
    if (value === null) {
      removeNode(null, previousValue, i)
      return null
    }

    if (valueIsArray) keyPath.index = i
    else delete keyPath.index

    previousValues[i] = value

    if (definition) {
      if (activeNode) removeNode(value, previousValue, i)
      currentNode = processNodes(scope, node, definition)
      keyPath.target = valueIsArray ? value[i] : value
      bindKeys(scope, value, definition, currentNode, keyPath)
      if (mount) {
        keyPath.target = value
        mount(currentNode, value, null, keyPath)
      }
    }

    else {
      currentNode = activeNode || node.cloneNode(true)

      if (change) {
        returnValue = change(currentNode, value, previousValue, keyPath)
        if (returnValue !== void 0)
          changeValue(currentNode, returnValue, branch[replaceAttributeKey])
      }
      else {
        // Add default update behavior. Note that this event does not get
        // removed, since it is assumed that it will be garbage collected.
        if (previousValue === null &&
          ~updateTags.indexOf(currentNode.tagName))
          currentNode.addEventListener('input',
            updateChange(branch[replaceAttributeKey], keyPath, key))

        changeValue(currentNode, value, branch[replaceAttributeKey])
      }

      // Do not actually add an element to the DOM if it's only a change
      // between non-empty values.
      if (activeNode) return null
    }

    activeNodes[i] = currentNode

    return currentNode
  }
function replaceNode (value, previousValue, i) {
    var activeNode = activeNodes[i]
    var currentNode = node
    var returnValue

    // Cast values to null if undefined.
    if (value === void 0) value = null
    if (previousValue === void 0) previousValue = null

    // If value is null, just remove the Node.
    if (value === null) {
      removeNode(null, previousValue, i)
      return null
    }

    if (valueIsArray) keyPath.index = i
    else delete keyPath.index

    previousValues[i] = value

    if (definition) {
      if (activeNode) removeNode(value, previousValue, i)
      currentNode = processNodes(scope, node, definition)
      keyPath.target = valueIsArray ? value[i] : value
      bindKeys(scope, value, definition, currentNode, keyPath)
      if (mount) {
        keyPath.target = value
        mount(currentNode, value, null, keyPath)
      }
    }

    else {
      currentNode = activeNode || node.cloneNode(true)

      if (change) {
        returnValue = change(currentNode, value, previousValue, keyPath)
        if (returnValue !== void 0)
          changeValue(currentNode, returnValue, branch[replaceAttributeKey])
      }
      else {
        // Add default update behavior. Note that this event does not get
        // removed, since it is assumed that it will be garbage collected.
        if (previousValue === null &&
          ~updateTags.indexOf(currentNode.tagName))
          currentNode.addEventListener('input',
            updateChange(branch[replaceAttributeKey], keyPath, key))

        changeValue(currentNode, value, branch[replaceAttributeKey])
      }

      // Do not actually add an element to the DOM if it's only a change
      // between non-empty values.
      if (activeNode) return null
    }

    activeNodes[i] = currentNode

    return currentNode
  }
function replaceNode ( value , previousValue , i ) { var activeNode = activeNodes [ i ] var currentNode = node var returnValue // Cast values to null if undefined. if ( value === void 0 ) value = null if ( previousValue === void 0 ) previousValue = null // If value is null, just remove the Node. if ( value === null ) { removeNode ( null , previousValue , i ) return null } if ( valueIsArray ) keyPath . index = i else delete keyPath . index previousValues [ i ] = value if ( definition ) { if ( activeNode ) removeNode ( value , previousValue , i ) currentNode = processNodes ( scope , node , definition ) keyPath . target = valueIsArray ? value [ i ] : value bindKeys ( scope , value , definition , currentNode , keyPath ) if ( mount ) { keyPath . target = value mount ( currentNode , value , null , keyPath ) } } else { currentNode = activeNode || node . cloneNode ( true ) if ( change ) { returnValue = change ( currentNode , value , previousValue , keyPath ) if ( returnValue !== void 0 ) changeValue ( currentNode , returnValue , branch [ replaceAttributeKey ] ) } else { // Add default update behavior. Note that this event does not get // removed, since it is assumed that it will be garbage collected. if ( previousValue === null && ~ updateTags . indexOf ( currentNode . tagName ) ) currentNode . addEventListener ( 'input' , updateChange ( branch [ replaceAttributeKey ] , keyPath , key ) ) changeValue ( currentNode , value , branch [ replaceAttributeKey ] ) } // Do not actually add an element to the DOM if it's only a change // between non-empty values. if ( activeNode ) return null } activeNodes [ i ] = currentNode return currentNode }
The return value of this function is a Node to be added, otherwise null.
The return value of this function is a Node to be added otherwise null .