src/view.js
function(el) {
		var self = this,
			$el = $(el);

		if ($el.length > 1) {
			$el.each(function() {
				self.addElement(this);
			});
		} else if ($el.length === 0) {
			throw new Error("Invalid element!");
		}

		if (this.$el.closest($el).length) {
			throw new Error("Element is a child of this view. This is only for unrelated elements");
		}
		if ($el.closest(this.$el).length) {
			throw new Error("Element is an ancestor of this view! Reconsider how you're using this view.");
		}

		// normalize
		el = $el.get(0);

		if (!this._trackedElements) {
			this._trackedElements = [];
		}
		_(this._trackedElements).each(function(otherEl) {
			var $otherEl = $(otherEl);

			if ($otherEl.closest($el).length) {
				throw new Error("Element is a child of another tracked element. This will cause problems.");
			}
			if ($el.closest($otherEl).length) {
				throw new Error("Element is an ancestor of another tracked element. This will cause problems.");
			}
		});
		this._trackedElements.push(el);
	}
function(el) {
		var self = this,
			$el = $(el);

		if ($el.length > 1) {
			$el.each(function() {
				self.addElement(this);
			});
		} else if ($el.length === 0) {
			throw new Error("Invalid element!");
		}

		if (this.$el.closest($el).length) {
			throw new Error("Element is a child of this view. This is only for unrelated elements");
		}
		if ($el.closest(this.$el).length) {
			throw new Error("Element is an ancestor of this view! Reconsider how you're using this view.");
		}

		// normalize
		el = $el.get(0);

		if (!this._trackedElements) {
			this._trackedElements = [];
		}
		_(this._trackedElements).each(function(otherEl) {
			var $otherEl = $(otherEl);

			if ($otherEl.closest($el).length) {
				throw new Error("Element is a child of another tracked element. This will cause problems.");
			}
			if ($el.closest($otherEl).length) {
				throw new Error("Element is an ancestor of another tracked element. This will cause problems.");
			}
		});
		this._trackedElements.push(el);
	}
function ( el ) { var self = this , $el = $ ( el ) ; if ( $el . length > 1 ) { $el . each ( function ( ) { self . addElement ( this ) ; } ) ; } else if ( $el . length === 0 ) { throw new Error ( "Invalid element!" ) ; } if ( this . $el . closest ( $el ) . length ) { throw new Error ( "Element is a child of this view. This is only for unrelated elements" ) ; } if ( $el . closest ( this . $el ) . length ) { throw new Error ( "Element is an ancestor of this view! Reconsider how you're using this view." ) ; } // normalize el = $el . get ( 0 ) ; if ( ! this . _trackedElements ) { this . _trackedElements = [ ] ; } _ ( this . _trackedElements ) . each ( function ( otherEl ) { var $otherEl = $ ( otherEl ) ; if ( $otherEl . closest ( $el ) . length ) { throw new Error ( "Element is a child of another tracked element. This will cause problems." ) ; } if ( $el . closest ( $otherEl ) . length ) { throw new Error ( "Element is an ancestor of another tracked element. This will cause problems." ) ; } } ) ; this . _trackedElements . push ( el ) ; }
track el as part of this view even though it's not a child..
track el as part of this view even though it s not a child ..