How to use the incremental-dom.elementOpen.apply function in incremental-dom

To help you get started, we’ve selected a few incremental-dom 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 eliot-akira / idom / src / index.js View on Github external
if (typeof tag === 'function') return tag(props, children)()

  // Prepare arguments
  // (See: http://google.github.io/incremental-dom/#api/elementOpen)
  let args = [tag, null, null]

  for (let key in props) {
    if (key==='key') {
      args[1] = props.key
      delete props.key
    }
    args.push(key)
    args.push(props[key])
  }

  elementOpen.apply(null, args)
  children.forEach(create)
  elementClose(tag)
}
github eliot-akira / idom / src / core / create / render-idom.js View on Github external
// Pass key as second argument to elementOpen
      argsArray[1] = attrs[key]

    } else {
      argsArray.push( attr )
      argsArray.push( attrs[attr] )
    }
  }

  if ( ! children || ! children.length ) {

    node.el = elementVoid.apply(null, argsArray)

  } else {
    elementOpen.apply(null, argsArray)
    children.forEach( renderIdom )
    node.el = elementClose(tag)
  }

  // If component instance, store reference to element
  if (node.instance)
    node.instance.el = node.el

  return node
}