lib/packages/core-classes.js
function(current_templates) {

		var i = 1,
			count = current_templates.length,
			guid,
			previous_template = current_templates[0];

		if (previous_template) { // if list is not empty

			delete this._remove_queue[previous_template.guid];

			// handle first template separately from others
			if (!previous_template.isInDOM()) {

				this._insertFirstTemplate(previous_template);
				this._fire('insertion_complete', previous_template);

			}

			for (; i < count; i++) {

				delete this._remove_queue[current_templates[i].guid];

				if (current_templates[i].isInDOM()) {

					this._moveTemplate(current_templates[i], previous_template, current_templates);

				} else {

					this._insertTemplate(current_templates[i], previous_template, i);
					this._fire('insertion_complete', current_templates[i]);

				}

				previous_template = current_templates[i];

			}

		}

		for (guid in this._remove_queue) {

			if (this._remove_queue[guid].isInDOM()) {

				this._removeTemplate(this._remove_queue[guid]);
				this._fire('removal_complete', this._remove_queue[guid]);

			}

		}

		this._remove_queue = {};

	}
function(current_templates) {

		var i = 1,
			count = current_templates.length,
			guid,
			previous_template = current_templates[0];

		if (previous_template) { // if list is not empty

			delete this._remove_queue[previous_template.guid];

			// handle first template separately from others
			if (!previous_template.isInDOM()) {

				this._insertFirstTemplate(previous_template);
				this._fire('insertion_complete', previous_template);

			}

			for (; i < count; i++) {

				delete this._remove_queue[current_templates[i].guid];

				if (current_templates[i].isInDOM()) {

					this._moveTemplate(current_templates[i], previous_template, current_templates);

				} else {

					this._insertTemplate(current_templates[i], previous_template, i);
					this._fire('insertion_complete', current_templates[i]);

				}

				previous_template = current_templates[i];

			}

		}

		for (guid in this._remove_queue) {

			if (this._remove_queue[guid].isInDOM()) {

				this._removeTemplate(this._remove_queue[guid]);
				this._fire('removal_complete', this._remove_queue[guid]);

			}

		}

		this._remove_queue = {};

	}
function ( current_templates ) { var i = 1 , count = current_templates . length , guid , previous_template = current_templates [ 0 ] ; if ( previous_template ) { // if list is not empty delete this . _remove_queue [ previous_template . guid ] ; // handle first template separately from others if ( ! previous_template . isInDOM ( ) ) { this . _insertFirstTemplate ( previous_template ) ; this . _fire ( 'insertion_complete' , previous_template ) ; } for ( ; i < count ; i ++ ) { delete this . _remove_queue [ current_templates [ i ] . guid ] ; if ( current_templates [ i ] . isInDOM ( ) ) { this . _moveTemplate ( current_templates [ i ] , previous_template , current_templates ) ; } else { this . _insertTemplate ( current_templates [ i ] , previous_template , i ) ; this . _fire ( 'insertion_complete' , current_templates [ i ] ) ; } previous_template = current_templates [ i ] ; } } for ( guid in this . _remove_queue ) { if ( this . _remove_queue [ guid ] . isInDOM ( ) ) { this . _removeTemplate ( this . _remove_queue [ guid ] ) ; this . _fire ( 'removal_complete' , this . _remove_queue [ guid ] ) ; } } this . _remove_queue = { } ; }
Insert new templates into DOM and remove those, which are queued for removal. Reorder existing templates
@param {Array.<Lava.system.Template>} current_templates Templates, that refresher must render and insert into DOM.
Some of them can be already in DOM.
Insert new templates into DOM and remove those which are queued for removal . Reorder existing templates