lib/air/template.js
function swap(source, target) {
  // wrap to allow string selectors, arrays etc.
  source = $(source);
  target = $(target);
  source.each(function(el, index) {
    var content = target.get(index);
    if(el.parentNode && content) {
      // deep clone template partial
      content = content.cloneNode(true);
      // replace sourc element with cloned target element
      el.parentNode.replaceChild(content, el);
    }
  })
}
function swap(source, target) {
  // wrap to allow string selectors, arrays etc.
  source = $(source);
  target = $(target);
  source.each(function(el, index) {
    var content = target.get(index);
    if(el.parentNode && content) {
      // deep clone template partial
      content = content.cloneNode(true);
      // replace sourc element with cloned target element
      el.parentNode.replaceChild(content, el);
    }
  })
}
function swap ( source , target ) { // wrap to allow string selectors, arrays etc. source = $ ( source ) ; target = $ ( target ) ; source . each ( function ( el , index ) { var content = target . get ( index ) ; if ( el . parentNode && content ) { // deep clone template partial content = content . cloneNode ( true ) ; // replace sourc element with cloned target element el . parentNode . replaceChild ( content , el ) ; } } ) }
Swap a source list of element's with a target list of element's.

The target elements are cloned as they should be template partials, the
source element(s) should exist in the DOM.
Swap a source list of element s with a target list of element s .