src/index.js
function getTemplateFromDomElement (domElement) {
  let data = {}
  let src = null

  if (domElement && domElement[STARDUX_PRIVATE_ATTR])
    data = mkdux(domElement)

  if ('string' == typeof domElement)
    src = domElement
  else if (data.src)
    src = data.src
  else if (domElement.children && 0 == domElement.children.length)
    src = ensureDOMString(domElement.textContent)
  else if (domElement.firstChild instanceof Text)
    src = ensureDOMString(domElement.innerHTML)
  else if (domElement instanceof Text)
    src = ensureDOMString(domElement.textContent)
  else if (domElement)
    src = domElement.innerHTML || domElement.textContent

  return src
}
function getTemplateFromDomElement (domElement) {
  let data = {}
  let src = null

  if (domElement && domElement[STARDUX_PRIVATE_ATTR])
    data = mkdux(domElement)

  if ('string' == typeof domElement)
    src = domElement
  else if (data.src)
    src = data.src
  else if (domElement.children && 0 == domElement.children.length)
    src = ensureDOMString(domElement.textContent)
  else if (domElement.firstChild instanceof Text)
    src = ensureDOMString(domElement.innerHTML)
  else if (domElement instanceof Text)
    src = ensureDOMString(domElement.textContent)
  else if (domElement)
    src = domElement.innerHTML || domElement.textContent

  return src
}
function getTemplateFromDomElement ( domElement ) { let data = { } let src = null if ( domElement && domElement [ STARDUX_PRIVATE_ATTR ] ) data = mkdux ( domElement ) if ( 'string' == typeof domElement ) src = domElement else if ( data . src ) src = data . src else if ( domElement . children && 0 == domElement . children . length ) src = ensureDOMString ( domElement . textContent ) else if ( domElement . firstChild instanceof Text ) src = ensureDOMString ( domElement . innerHTML ) else if ( domElement instanceof Text ) src = ensureDOMString ( domElement . textContent ) else if ( domElement ) src = domElement . innerHTML || domElement . textContent return src }
Returns a template tring from a given
DOM Element. If the DOM Element given is a
string then it is simply returned.

@public
@param {Element|String} domElement
@return {String}
Returns a template tring from a given DOM Element . If the DOM Element given is a string then it is simply returned .