public/ckeditor/4.4dev/core/dom/node.js
function( query, includeSelf ) {
		var $ = this.$,
			evaluator,
			isCustomEvaluator;

		if ( !includeSelf ) {
			$ = $.parentNode;
		}

		// Custom checker provided in an argument.
		if ( typeof query == 'function' ) {
			isCustomEvaluator = true;
			evaluator = query;
		} else {
			// Predefined tag name checker.
			isCustomEvaluator = false;
			evaluator = function( $ ) {
				var name = ( typeof $.nodeName == 'string' ? $.nodeName.toLowerCase() : '' );

				return ( typeof query == 'string' ? name == query : name in query );
			};
		}

		while ( $ ) {
			// For user provided checker we use CKEDITOR.dom.node.
			if ( evaluator( isCustomEvaluator ? new CKEDITOR.dom.node( $ ) : $ ) ) {
				return new CKEDITOR.dom.node( $ );
			}

			try {
				$ = $.parentNode;
			} catch ( e ) {
				$ = null;
			}
		}

		return null;
	}
function( query, includeSelf ) {
		var $ = this.$,
			evaluator,
			isCustomEvaluator;

		if ( !includeSelf ) {
			$ = $.parentNode;
		}

		// Custom checker provided in an argument.
		if ( typeof query == 'function' ) {
			isCustomEvaluator = true;
			evaluator = query;
		} else {
			// Predefined tag name checker.
			isCustomEvaluator = false;
			evaluator = function( $ ) {
				var name = ( typeof $.nodeName == 'string' ? $.nodeName.toLowerCase() : '' );

				return ( typeof query == 'string' ? name == query : name in query );
			};
		}

		while ( $ ) {
			// For user provided checker we use CKEDITOR.dom.node.
			if ( evaluator( isCustomEvaluator ? new CKEDITOR.dom.node( $ ) : $ ) ) {
				return new CKEDITOR.dom.node( $ );
			}

			try {
				$ = $.parentNode;
			} catch ( e ) {
				$ = null;
			}
		}

		return null;
	}
function ( query , includeSelf ) { var $ = this . $ , evaluator , isCustomEvaluator ; if ( ! includeSelf ) { $ = $ . parentNode ; } // Custom checker provided in an argument. if ( typeof query == 'function' ) { isCustomEvaluator = true ; evaluator = query ; } else { // Predefined tag name checker. isCustomEvaluator = false ; evaluator = function ( $ ) { var name = ( typeof $ . nodeName == 'string' ? $ . nodeName . toLowerCase ( ) : '' ) ; return ( typeof query == 'string' ? name == query : name in query ) ; } ; } while ( $ ) { // For user provided checker we use CKEDITOR.dom.node. if ( evaluator ( isCustomEvaluator ? new CKEDITOR . dom . node ( $ ) : $ ) ) { return new CKEDITOR . dom . node ( $ ) ; } try { $ = $ . parentNode ; } catch ( e ) { $ = null ; } } return null ; }
Gets the closest ancestor node of this node, specified by its name or using an evaluator function.

// Suppose we have the following HTML structure:
// <div id="outer"><div id="inner"><p><b>Some text</b></p></div></div>
// If node == <b>
ascendant = node.getAscendant( 'div' );				// ascendant == <div id="inner">
ascendant = node.getAscendant( 'b' );				// ascendant == null
ascendant = node.getAscendant( 'b', true );			// ascendant == <b>
ascendant = node.getAscendant( { div:1, p:1 } );	// Searches for the first 'div' or 'p': ascendant == <div id="inner">

// Using custom evaluator:
ascendant = node.getAscendant( function( el ) {
return el.getId() == 'inner';
} );
// ascendant == <div id="inner">

@since 3.6.1
@param {String/Function/Object} query The name of the ancestor node to search or
an object with the node names to search for or an evaluator function.
@param {Boolean} [includeSelf] Whether to include the current
node in the search.
@returns {CKEDITOR.dom.node} The located ancestor node or `null` if not found.
Gets the closest ancestor node of this node specified by its name or using an evaluator function .