src/compile.js
function compile(fragments, template) {
  var walker = document.createTreeWalker(template, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT);
  var bindings = [], currentNode, parentNode, previousNode;

  // Reset first node to ensure it isn't a fragment
  walker.nextNode();
  walker.previousNode();

  // find bindings for each node
  do {
    currentNode = walker.currentNode;
    parentNode = currentNode.parentNode;
    bindings.push.apply(bindings, getBindingsForNode(fragments, currentNode, template));

    if (currentNode.parentNode !== parentNode) {
      // currentNode was removed and made a template
      walker.currentNode = previousNode || walker.root;
    } else {
      previousNode = currentNode;
    }
  } while (walker.nextNode());

  return bindings;
}
function compile(fragments, template) {
  var walker = document.createTreeWalker(template, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT);
  var bindings = [], currentNode, parentNode, previousNode;

  // Reset first node to ensure it isn't a fragment
  walker.nextNode();
  walker.previousNode();

  // find bindings for each node
  do {
    currentNode = walker.currentNode;
    parentNode = currentNode.parentNode;
    bindings.push.apply(bindings, getBindingsForNode(fragments, currentNode, template));

    if (currentNode.parentNode !== parentNode) {
      // currentNode was removed and made a template
      walker.currentNode = previousNode || walker.root;
    } else {
      previousNode = currentNode;
    }
  } while (walker.nextNode());

  return bindings;
}
function compile ( fragments , template ) { var walker = document . createTreeWalker ( template , NodeFilter . SHOW_ELEMENT | NodeFilter . SHOW_TEXT ) ; var bindings = [ ] , currentNode , parentNode , previousNode ; // Reset first node to ensure it isn't a fragment walker . nextNode ( ) ; walker . previousNode ( ) ; // find bindings for each node do { currentNode = walker . currentNode ; parentNode = currentNode . parentNode ; bindings . push . apply ( bindings , getBindingsForNode ( fragments , currentNode , template ) ) ; if ( currentNode . parentNode !== parentNode ) { // currentNode was removed and made a template walker . currentNode = previousNode || walker . root ; } else { previousNode = currentNode ; } } while ( walker . nextNode ( ) ) ; return bindings ; }
Walks the template DOM replacing any bindings and caching bindings onto the template object.
Walks the template DOM replacing any bindings and caching bindings onto the template object .