Demo/src/main/webapp/resources/js/jquery/js/plugin/css3-multi-column.js
// the function returns an array of matching elements

the function returns an array of matching elements
the function returns an array of matching elements
function select(from, token, filter) {
		var namespace = "";
		if (NAMESPACE.test(filter)) {
			filter = filter.split("|");
			namespace = filter[0];
			filter = filter[1];
		}
		var filtered = [], i;
		switch (token) {
			case " ": 
				for (i in from) {
					if (typeof from[i] == 'function') continue;
					var subset = getElementsByTagNameNS(from[i], filter, namespace);
					for (var j = 0; j < subset.length; j++) {
						if (isElement(subset[j]) && (!namespace || compareNamespace(subset[j], namespace)))
							push(filtered, subset[j]);
					}
				}
				break;
			case ">": 
				for (i in from) {
					var subset = from[i].childNodes;
					for (var j = 0; j < subset.length; j++)
						if (compareTagName(subset[j], filter, namespace)) push(filtered, subset[j]);
				}
				break;
			case "+": 
				for (i in from) {
					var adjacent = nextElement(from[i]);
					if (adjacent && compareTagName(adjacent, filter, namespace)) push(filtered, adjacent);
				}
				break;
			case "~": 
				for (i in from) {
					var adjacent = from[i];
					while (adjacent = nextElement(adjacent)) {
						if (adjacent && compareTagName(adjacent, filter, namespace)) push(filtered, adjacent);
					}
				}
				break;
			case ".": 
				filter = new RegExp("(^|\\s)" + filter + "(\\s|$)");
				for (i in from) if (filter.test(from[i].className)) push(filtered, from[i]);
				break;
			case "#": 
				for (i in from) if (from[i].id == filter) push(filtered, from[i]);
				break;
			case "@": 
				filter = attributeSelectors[filter];
				for (i in from) if (filter(from[i])) push(filtered, from[i]);
				break;
			case ":": 
				filter = pseudoClasses[filter];
				for (i in from) if (filter(from[i])) push(filtered, from[i]);
				break;
		}
		return filtered;
	}
function select ( from , token , filter ) { var namespace = "" ; if ( NAMESPACE . test ( filter ) ) { filter = filter . split ( "|" ) ; namespace = filter [ 0 ] ; filter = filter [ 1 ] ; } var filtered = [ ] , i ; switch ( token ) { case " " : for ( i in from ) { if ( typeof from [ i ] == 'function' ) continue ; var subset = getElementsByTagNameNS ( from [ i ] , filter , namespace ) ; for ( var j = 0 ; j < subset . length ; j ++ ) { if ( isElement ( subset [ j ] ) && ( ! namespace || compareNamespace ( subset [ j ] , namespace ) ) ) push ( filtered , subset [ j ] ) ; } } break ; case ">" : for ( i in from ) { var subset = from [ i ] . childNodes ; for ( var j = 0 ; j < subset . length ; j ++ ) if ( compareTagName ( subset [ j ] , filter , namespace ) ) push ( filtered , subset [ j ] ) ; } break ; case "+" : for ( i in from ) { var adjacent = nextElement ( from [ i ] ) ; if ( adjacent && compareTagName ( adjacent , filter , namespace ) ) push ( filtered , adjacent ) ; } break ; case "~" : for ( i in from ) { var adjacent = from [ i ] ; while ( adjacent = nextElement ( adjacent ) ) { if ( adjacent && compareTagName ( adjacent , filter , namespace ) ) push ( filtered , adjacent ) ; } } break ; case "." : filter = new RegExp ( "(^|\\s)" + filter + "(\\s|$)" ) ; for ( i in from ) if ( filter . test ( from [ i ] . className ) ) push ( filtered , from [ i ] ) ; break ; case "#" : for ( i in from ) if ( from [ i ] . id == filter ) push ( filtered , from [ i ] ) ; break ; case "@" : filter = attributeSelectors [ filter ] ; for ( i in from ) if ( filter ( from [ i ] ) ) push ( filtered , from [ i ] ) ; break ; case ":" : filter = pseudoClasses [ filter ] ; for ( i in from ) if ( filter ( from [ i ] ) ) push ( filtered , from [ i ] ) ; break ; } return filtered ; }
the function returns an array of matching elements
the function returns an array of matching elements
//alert("token="+token+",filter="+filter);
 // descendant
 // child
 // adjacent (direct)
 // adjacent (indirect)
 // class
 // id
 // attribute selector
 // pseudo-class (static)
