lib/CssSelector.js
function (mergeSelector) {

		if (this.tag !== mergeSelector.tag) {
			throw "different element selected (tag)";
		}

		if (this.index !== null) {
			if (this.index !== mergeSelector.index) {

				// use indexn only for two elements
				if (this.indexn === null) {
					var indexn = Math.min(mergeSelector.index, this.index);
					if (indexn > 1) {
						this.indexn = Math.min(mergeSelector.index, this.index);
					}
				}
				else {
					this.indexn = -1;
				}

				this.index = null;
			}
		}

		if(this.isDirectChild === true) {
			this.isDirectChild = mergeSelector.isDirectChild;
		}

		if (this.id !== null) {
			if (this.id !== mergeSelector.id) {
				this.id = null;
			}
		}

		if (this.classes.length !== 0) {
			var classes = new Array();

			for (var i in this.classes) {
				var cclass = this.classes[i];
				if (mergeSelector.classes.indexOf(cclass) !== -1) {
					classes.push(cclass);
				}
			}

			this.classes = classes;
		}
	}
function (mergeSelector) {

		if (this.tag !== mergeSelector.tag) {
			throw "different element selected (tag)";
		}

		if (this.index !== null) {
			if (this.index !== mergeSelector.index) {

				// use indexn only for two elements
				if (this.indexn === null) {
					var indexn = Math.min(mergeSelector.index, this.index);
					if (indexn > 1) {
						this.indexn = Math.min(mergeSelector.index, this.index);
					}
				}
				else {
					this.indexn = -1;
				}

				this.index = null;
			}
		}

		if(this.isDirectChild === true) {
			this.isDirectChild = mergeSelector.isDirectChild;
		}

		if (this.id !== null) {
			if (this.id !== mergeSelector.id) {
				this.id = null;
			}
		}

		if (this.classes.length !== 0) {
			var classes = new Array();

			for (var i in this.classes) {
				var cclass = this.classes[i];
				if (mergeSelector.classes.indexOf(cclass) !== -1) {
					classes.push(cclass);
				}
			}

			this.classes = classes;
		}
	}
function ( mergeSelector ) { if ( this . tag !== mergeSelector . tag ) { throw "different element selected (tag)" ; } if ( this . index !== null ) { if ( this . index !== mergeSelector . index ) { // use indexn only for two elements if ( this . indexn === null ) { var indexn = Math . min ( mergeSelector . index , this . index ) ; if ( indexn > 1 ) { this . indexn = Math . min ( mergeSelector . index , this . index ) ; } } else { this . indexn = - 1 ; } this . index = null ; } } if ( this . isDirectChild === true ) { this . isDirectChild = mergeSelector . isDirectChild ; } if ( this . id !== null ) { if ( this . id !== mergeSelector . id ) { this . id = null ; } } if ( this . classes . length !== 0 ) { var classes = new Array ( ) ; for ( var i in this . classes ) { var cclass = this . classes [ i ] ; if ( mergeSelector . classes . indexOf ( cclass ) !== - 1 ) { classes . push ( cclass ) ; } } this . classes = classes ; } }
merges this selector with another one.
merges this selector with another one .