public/ckeditor/4.4dev/core/dom/elementpath.js
function( query, excludeRoot, fromTop ) {
		var evaluator;
		if ( typeof query == 'string' )
			evaluator = function( node ) {
				return node.getName() == query;
			};
		if ( query instanceof CKEDITOR.dom.element )
			evaluator = function( node ) {
				return node.equals( query );
			};
		else if ( CKEDITOR.tools.isArray( query ) )
			evaluator = function( node ) {
				return CKEDITOR.tools.indexOf( query, node.getName() ) > -1;
			};
		else if ( typeof query == 'function' )
			evaluator = query;
		else if ( typeof query == 'object' )
			evaluator = function( node ) {
				return node.getName() in query;
			};

		var elements = this.elements,
			length = elements.length;
		excludeRoot && length--;

		if ( fromTop ) {
			elements = Array.prototype.slice.call( elements, 0 );
			elements.reverse();
		}

		for ( var i = 0; i < length; i++ ) {
			if ( evaluator( elements[ i ] ) )
				return elements[ i ];
		}

		return null;
	}
function( query, excludeRoot, fromTop ) {
		var evaluator;
		if ( typeof query == 'string' )
			evaluator = function( node ) {
				return node.getName() == query;
			};
		if ( query instanceof CKEDITOR.dom.element )
			evaluator = function( node ) {
				return node.equals( query );
			};
		else if ( CKEDITOR.tools.isArray( query ) )
			evaluator = function( node ) {
				return CKEDITOR.tools.indexOf( query, node.getName() ) > -1;
			};
		else if ( typeof query == 'function' )
			evaluator = query;
		else if ( typeof query == 'object' )
			evaluator = function( node ) {
				return node.getName() in query;
			};

		var elements = this.elements,
			length = elements.length;
		excludeRoot && length--;

		if ( fromTop ) {
			elements = Array.prototype.slice.call( elements, 0 );
			elements.reverse();
		}

		for ( var i = 0; i < length; i++ ) {
			if ( evaluator( elements[ i ] ) )
				return elements[ i ];
		}

		return null;
	}
function ( query , excludeRoot , fromTop ) { var evaluator ; if ( typeof query == 'string' ) evaluator = function ( node ) { return node . getName ( ) == query ; } ; if ( query instanceof CKEDITOR . dom . element ) evaluator = function ( node ) { return node . equals ( query ) ; } ; else if ( CKEDITOR . tools . isArray ( query ) ) evaluator = function ( node ) { return CKEDITOR . tools . indexOf ( query , node . getName ( ) ) > - 1 ; } ; else if ( typeof query == 'function' ) evaluator = query ; else if ( typeof query == 'object' ) evaluator = function ( node ) { return node . getName ( ) in query ; } ; var elements = this . elements , length = elements . length ; excludeRoot && length -- ; if ( fromTop ) { elements = Array . prototype . slice . call ( elements , 0 ) ; elements . reverse ( ) ; } for ( var i = 0 ; i < length ; i ++ ) { if ( evaluator ( elements [ i ] ) ) return elements [ i ] ; } return null ; }
Search the path elements that meets the specified criteria.

@param {String/Array/Function/Object/CKEDITOR.dom.element} query The criteria that can be
either a tag name, list (array and object) of tag names, element or an node evaluator function.
@param {Boolean} [excludeRoot] Not taking path root element into consideration.
@param {Boolean} [fromTop] Search start from the topmost element instead of bottom.
@returns {CKEDITOR.dom.element} The first matched dom element or `null`.
Search the path elements that meets the specified criteria .