backbone.layoutmanager.js
function(rootView, subViews, selector) {
    // Shorthand the parent manager object.
    var rentManager = rootView.__manager__;
    // Create a simplified manager object that tells partial() where
    // place the elements.
    var manager = { selector: selector };

    // Get the elements to be inserted into the root view.
    var els = _.reduce(subViews, function(memo, sub) {
      // Check if keep is present - do boolean check in case the user
      // has created a `keep` function.
      var keep = typeof sub.keep === "boolean" ? sub.keep : sub.options.keep;
      // If a subView is present, don't push it.  This can only happen if
      // `keep: true`.  We do the keep check for speed as $.contains is not
      // cheap.
      var exists = keep && $.contains(rootView.el, sub.el);

      // If there is an element and it doesn't already exist in our structure
      // attach it.
      if (sub.el && !exists) {
        memo.push(sub.el);
      }

      return memo;
    }, []);

    // Use partial to apply the elements. Wrap els in jQ obj for cheerio.
    return this.partial(rootView.$el, $(els), rentManager, manager);
  }
function(rootView, subViews, selector) {
    // Shorthand the parent manager object.
    var rentManager = rootView.__manager__;
    // Create a simplified manager object that tells partial() where
    // place the elements.
    var manager = { selector: selector };

    // Get the elements to be inserted into the root view.
    var els = _.reduce(subViews, function(memo, sub) {
      // Check if keep is present - do boolean check in case the user
      // has created a `keep` function.
      var keep = typeof sub.keep === "boolean" ? sub.keep : sub.options.keep;
      // If a subView is present, don't push it.  This can only happen if
      // `keep: true`.  We do the keep check for speed as $.contains is not
      // cheap.
      var exists = keep && $.contains(rootView.el, sub.el);

      // If there is an element and it doesn't already exist in our structure
      // attach it.
      if (sub.el && !exists) {
        memo.push(sub.el);
      }

      return memo;
    }, []);

    // Use partial to apply the elements. Wrap els in jQ obj for cheerio.
    return this.partial(rootView.$el, $(els), rentManager, manager);
  }
function ( rootView , subViews , selector ) { // Shorthand the parent manager object. var rentManager = rootView . __manager__ ; // Create a simplified manager object that tells partial() where // place the elements. var manager = { selector : selector } ; // Get the elements to be inserted into the root view. var els = _ . reduce ( subViews , function ( memo , sub ) { // Check if keep is present - do boolean check in case the user // has created a `keep` function. var keep = typeof sub . keep === "boolean" ? sub . keep : sub . options . keep ; // If a subView is present, don't push it.  This can only happen if // `keep: true`.  We do the keep check for speed as $.contains is not // cheap. var exists = keep && $ . contains ( rootView . el , sub . el ) ; // If there is an element and it doesn't already exist in our structure // attach it. if ( sub . el && ! exists ) { memo . push ( sub . el ) ; } return memo ; } , [ ] ) ; // Use partial to apply the elements. Wrap els in jQ obj for cheerio. return this . partial ( rootView . $el , $ ( els ) , rentManager , manager ) ; }
Used for inserting subViews in a single batch.  This gives a small performance boost as we write to a disconnected fragment instead of to the DOM directly. Smarter browsers like Chrome will batch writes internally and layout as seldom as possible, but even in that case this provides a decent boost.  jQuery will use a DocumentFragment for the batch update, but Cheerio in Node will not.
Used for inserting subViews in a single batch . This gives a small performance boost as we write to a disconnected fragment instead of to the DOM directly . Smarter browsers like Chrome will batch writes internally and layout as seldom as possible but even in that case this provides a decent boost . jQuery will use a DocumentFragment for the batch update but Cheerio in Node will not .