(function(undefined) {
  var _applyBindings,
    attrRegex = /^data-ko-/,
    propRegex = /^data-ko-(.+)/,
    parse;
  if(!ko) {
    throw 'Knockout hasn\'t been included on the page yet, ensure that knockout.preparser is included after knockout itself';
  }
  
  _applyBindings = ko.applyBindings;
  
  parse = function(node) {
    var attributes = node.attributes,
        attribute,
        dataBind = '';
        
    for(var i=0, il=attributes.length; i < il; i++) {
      attribute = attributes[i];
      if(attrRegex.test(attribute.name)) {
        if(dataBind) {
          dataBind += ',';
        }
        dataBind += attribute.name.match(propRegex)[1] + ':' + attribute.value;
      }
    }
    
    node.setAttribute('data-bind', dataBind);
    
    for(var i=0, il = node.childNodes; i < il; i++) {
      parse(node.childNodes[i]);
    }
  };
  
  ko.applyBindings = function(viewModel, rootNode) {
    rootNode = rootNode || window.document.body;    
    parse(rootNode);
    _applyBindings(viewModel, rootNode);
  };
})();
@@ -415,16 +415,53 @@
 ind = ''
+,%0D%0A        children = node.childNodes
 ;%0D%0A     
@@ -839,31 +839,24 @@
 0, il = 
-node.childNodes
+children
 ; i %3C il
@@ -877,31 +877,24 @@
   parse(
-node.childNodes
+children
 %5Bi%5D);%0D%0A 

refactor for performance