function createElement(template) {
    var attrib, value, childTemplate, i, l;

    var elem = window.document.createElement(template.tagName);
    delete template.tagName;

    for (attrib in template) {
      value = template[attrib];
      if (typeof value === 'undefined') {
        continue;
      }
      switch (attrib) {
        case 'style':
          elem.style.cssText = value;
          break;
        case 'children':
          for (i = 0, l = value.length; i < l; i++) {
            childTemplate = value[i];
            elem.appendChild(createElement(childTemplate));
          }
          break;
        default:
          elem[attrib] = value;
      }
    }

    return elem;
  }
// Creates a DOM element from the given template.
Creates a DOM element from the given template.
Creates a DOM element from the given template .
function createElement(template) {
    var attrib, value, childTemplate, i, l;
    var elem = window.document.createElement(template.tagName);
    delete template.tagName;
    for (attrib in template) {
      value = template[attrib];
      if (typeof value === 'undefined') {
        continue;
      }
      switch (attrib) {
        case 'style':
          elem.style.cssText = value;
          break;
        case 'children':
          for (i = 0, l = value.length; i < l; i++) {
            childTemplate = value[i];
            elem.appendChild(createElement(childTemplate));
          }
          break;
        default:
          elem[attrib] = value;
      }
    }
    return elem;
  }
function createElement ( template ) { var attrib , value , childTemplate , i , l ; var elem = window . document . createElement ( template . tagName ) ; delete template . tagName ; for ( attrib in template ) { value = template [ attrib ] ; if ( typeof value === 'undefined' ) { continue ; } switch ( attrib ) { case 'style' : elem . style . cssText = value ; break ; case 'children' : for ( i = 0 , l = value . length ; i < l ; i ++ ) { childTemplate = value [ i ] ; elem . appendChild ( createElement ( childTemplate ) ) ; } break ; default : elem [ attrib ] = value ; } } return elem ; }
Creates a DOM element from the given template.
Creates a DOM element from the given template .