src/compiler/unsafe.js
function unsafe(root, nodes, html) {
  var node, j, i = nodes.length, element = document.createElement('div');
  element.innerHTML = html;

  while (i --> 0)
    nodes[i].parentNode.removeChild(nodes.pop());

  for (i = j = element.childNodes.length - 1; j >= 0; j--)
    nodes.push(element.childNodes[j]);

  ++i;
  if (root.nodeType == 8)
    if (root.parentNode)
      while (i --> 0)
        root.parentNode.insertBefore(nodes[i], root);

    else
      throw "Can not insert child view into parent node. You need append your view first and then update.";

  else
    while (i --> 0)
      root.appendChild(nodes[i]);
}
function unsafe(root, nodes, html) {
  var node, j, i = nodes.length, element = document.createElement('div');
  element.innerHTML = html;

  while (i --> 0)
    nodes[i].parentNode.removeChild(nodes.pop());

  for (i = j = element.childNodes.length - 1; j >= 0; j--)
    nodes.push(element.childNodes[j]);

  ++i;
  if (root.nodeType == 8)
    if (root.parentNode)
      while (i --> 0)
        root.parentNode.insertBefore(nodes[i], root);

    else
      throw "Can not insert child view into parent node. You need append your view first and then update.";

  else
    while (i --> 0)
      root.appendChild(nodes[i]);
}
function unsafe ( root , nodes , html ) { var node , j , i = nodes . length , element = document . createElement ( 'div' ) ; element . innerHTML = html ; while ( i -- > 0 ) nodes [ i ] . parentNode . removeChild ( nodes . pop ( ) ) ; for ( i = j = element . childNodes . length - 1 ; j >= 0 ; j -- ) nodes . push ( element . childNodes [ j ] ) ; ++ i ; if ( root . nodeType == 8 ) if ( root . parentNode ) while ( i -- > 0 ) root . parentNode . insertBefore ( nodes [ i ] , root ) ; else throw "Can not insert child view into parent node. You need append your view first and then update." ; else while ( i -- > 0 ) root . appendChild ( nodes [ i ] ) ; }
This function is being used for unsafe `innerHTML` insertion of HTML into DOM.
Code looks strange. I know. But it is possible minimalistic implementation of.

@param root {Element} Node there to insert unsafe html.
@param nodes {Array} List of already inserted html nodes for remove.
@param html {string} Unsafe html to insert.
This function is being used for unsafe innerHTML insertion of HTML into DOM . Code looks strange . I know . But it is possible minimalistic implementation of .