src/dom.js
function createElements(tagName, attrs, children) {
  const element = isSVG(tagName)
    ? document.createElementNS('http://www.w3.org/2000/svg', tagName)
    : document.createElement(tagName)

  // one or multiple will be evaluated to append as string or HTMLElement
  const fragment = createFragmentFrom(children)
  element.appendChild(fragment)

  Object.keys(attrs || {}).forEach(prop => {
    if (prop === 'style') {
      // e.g. origin: <element style={{ prop: value }} />
      Object.assign(element.style, attrs[prop])
    } else if (prop === 'ref' && typeof attrs.ref === 'function') {
      attrs.ref(element, attrs)
    } else if (prop === 'className') {
      element.setAttribute('class', attrs[prop])
    } else if (prop === 'xlinkHref') {
      element.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', attrs[prop])
    } else if (prop === 'dangerouslySetInnerHTML') {
      // eslint-disable-next-line no-underscore-dangle
      element.innerHTML = attrs[prop].__html
    } else {
      // any other prop will be set as attribute
      element.setAttribute(prop, attrs[prop])
    }
  })

  return element
}
function createElements(tagName, attrs, children) {
  const element = isSVG(tagName)
    ? document.createElementNS('http://www.w3.org/2000/svg', tagName)
    : document.createElement(tagName)

  // one or multiple will be evaluated to append as string or HTMLElement
  const fragment = createFragmentFrom(children)
  element.appendChild(fragment)

  Object.keys(attrs || {}).forEach(prop => {
    if (prop === 'style') {
      // e.g. origin: <element style={{ prop: value }} />
      Object.assign(element.style, attrs[prop])
    } else if (prop === 'ref' && typeof attrs.ref === 'function') {
      attrs.ref(element, attrs)
    } else if (prop === 'className') {
      element.setAttribute('class', attrs[prop])
    } else if (prop === 'xlinkHref') {
      element.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', attrs[prop])
    } else if (prop === 'dangerouslySetInnerHTML') {
      // eslint-disable-next-line no-underscore-dangle
      element.innerHTML = attrs[prop].__html
    } else {
      // any other prop will be set as attribute
      element.setAttribute(prop, attrs[prop])
    }
  })

  return element
}
function createElements ( tagName , attrs , children ) { const element = isSVG ( tagName ) ? document . createElementNS ( 'http://www.w3.org/2000/svg' , tagName ) : document . createElement ( tagName ) // one or multiple will be evaluated to append as string or HTMLElement const fragment = createFragmentFrom ( children ) element . appendChild ( fragment ) Object . keys ( attrs || { } ) . forEach ( prop => { if ( prop === 'style' ) { // e.g. origin: <element style={{ prop: value }} /> Object . assign ( element . style , attrs [ prop ] ) } else if ( prop === 'ref' && typeof attrs . ref === 'function' ) { attrs . ref ( element , attrs ) } else if ( prop === 'className' ) { element . setAttribute ( 'class' , attrs [ prop ] ) } else if ( prop === 'xlinkHref' ) { element . setAttributeNS ( 'http://www.w3.org/1999/xlink' , 'xlink:href' , attrs [ prop ] ) } else if ( prop === 'dangerouslySetInnerHTML' ) { // eslint-disable-next-line no-underscore-dangle element . innerHTML = attrs [ prop ] . __html } else { // any other prop will be set as attribute element . setAttribute ( prop , attrs [ prop ] ) } } ) return element }
The tag name and create an html together with the attributes

@param  {String} tagName name as string, e.g. 'div', 'span', 'svg'
@param  {Object} attrs html attributes e.g. data-, width, src
@param  {Array} children html nodes from inside de elements
@return {HTMLElement} html node with attrs
The tag name and create an html together with the attributes