src/compile.js
function splitTextNode(fragments, node) {
  if (!node.processed) {
    node.processed = true;
    var regex = fragments.binders.text._expr;
    var content = node.nodeValue;
    if (content.match(regex)) {
      var match, lastIndex = 0, parts = [], fragment = document.createDocumentFragment();
      while ((match = regex.exec(content))) {
        parts.push(content.slice(lastIndex, regex.lastIndex - match[0].length));
        parts.push(match[0]);
        lastIndex = regex.lastIndex;
      }
      parts.push(content.slice(lastIndex));
      parts = parts.filter(notEmpty);

      node.nodeValue = parts[0];
      for (var i = 1; i < parts.length; i++) {
        var newTextNode = document.createTextNode(parts[i]);
        newTextNode.processed = true;
        fragment.appendChild(newTextNode);
      }
      node.parentNode.insertBefore(fragment, node.nextSibling);
    }
  }
}
function splitTextNode(fragments, node) {
  if (!node.processed) {
    node.processed = true;
    var regex = fragments.binders.text._expr;
    var content = node.nodeValue;
    if (content.match(regex)) {
      var match, lastIndex = 0, parts = [], fragment = document.createDocumentFragment();
      while ((match = regex.exec(content))) {
        parts.push(content.slice(lastIndex, regex.lastIndex - match[0].length));
        parts.push(match[0]);
        lastIndex = regex.lastIndex;
      }
      parts.push(content.slice(lastIndex));
      parts = parts.filter(notEmpty);

      node.nodeValue = parts[0];
      for (var i = 1; i < parts.length; i++) {
        var newTextNode = document.createTextNode(parts[i]);
        newTextNode.processed = true;
        fragment.appendChild(newTextNode);
      }
      node.parentNode.insertBefore(fragment, node.nextSibling);
    }
  }
}
function splitTextNode ( fragments , node ) { if ( ! node . processed ) { node . processed = true ; var regex = fragments . binders . text . _expr ; var content = node . nodeValue ; if ( content . match ( regex ) ) { var match , lastIndex = 0 , parts = [ ] , fragment = document . createDocumentFragment ( ) ; while ( ( match = regex . exec ( content ) ) ) { parts . push ( content . slice ( lastIndex , regex . lastIndex - match [ 0 ] . length ) ) ; parts . push ( match [ 0 ] ) ; lastIndex = regex . lastIndex ; } parts . push ( content . slice ( lastIndex ) ) ; parts = parts . filter ( notEmpty ) ; node . nodeValue = parts [ 0 ] ; for ( var i = 1 ; i < parts . length ; i ++ ) { var newTextNode = document . createTextNode ( parts [ i ] ) ; newTextNode . processed = true ; fragment . appendChild ( newTextNode ) ; } node . parentNode . insertBefore ( fragment , node . nextSibling ) ; } } }
Splits text nodes with expressions in them so they can be bound individually, has parentNode passed in since it may be a document fragment which appears as null on node.parentNode.
Splits text nodes with expressions in them so they can be bound individually has parentNode passed in since it may be a document fragment which appears as null on node . parentNode .