public/ckeditor/_source/plugins/selection/plugin.js
function()
		{
			var cache = this._.cache;
			if ( cache.startElement !== undefined )
				return cache.startElement;

			var node,
				sel = this.getNative();

			switch ( this.getType() )
			{
				case CKEDITOR.SELECTION_ELEMENT :
					return this.getSelectedElement();

				case CKEDITOR.SELECTION_TEXT :

					var range = this.getRanges()[0];

					if ( range )
					{
						if ( !range.collapsed )
						{
							range.optimize();

							// Decrease the range content to exclude particial
							// selected node on the start which doesn't have
							// visual impact. ( #3231 )
							while ( 1 )
							{
								var startContainer = range.startContainer,
									startOffset = range.startOffset;
								// Limit the fix only to non-block elements.(#3950)
								if ( startOffset == ( startContainer.getChildCount ?
									 startContainer.getChildCount() : startContainer.getLength() )
									 && !startContainer.isBlockBoundary() )
									range.setStartAfter( startContainer );
								else break;
							}

							node = range.startContainer;

							if ( node.type != CKEDITOR.NODE_ELEMENT )
								return node.getParent();

							node = node.getChild( range.startOffset );

							if ( !node || node.type != CKEDITOR.NODE_ELEMENT )
								node = range.startContainer;
							else
							{
								var child = node.getFirst();
								while (  child && child.type == CKEDITOR.NODE_ELEMENT )
								{
									node = child;
									child = child.getFirst();
								}
							}
						}
						else
						{
							node = range.startContainer;
							if ( node.type != CKEDITOR.NODE_ELEMENT )
								node = node.getParent();
						}

						node = node.$;
					}
			}

			return cache.startElement = ( node ? new CKEDITOR.dom.element( node ) : null );
		}
function()
		{
			var cache = this._.cache;
			if ( cache.startElement !== undefined )
				return cache.startElement;

			var node,
				sel = this.getNative();

			switch ( this.getType() )
			{
				case CKEDITOR.SELECTION_ELEMENT :
					return this.getSelectedElement();

				case CKEDITOR.SELECTION_TEXT :

					var range = this.getRanges()[0];

					if ( range )
					{
						if ( !range.collapsed )
						{
							range.optimize();

							// Decrease the range content to exclude particial
							// selected node on the start which doesn't have
							// visual impact. ( #3231 )
							while ( 1 )
							{
								var startContainer = range.startContainer,
									startOffset = range.startOffset;
								// Limit the fix only to non-block elements.(#3950)
								if ( startOffset == ( startContainer.getChildCount ?
									 startContainer.getChildCount() : startContainer.getLength() )
									 && !startContainer.isBlockBoundary() )
									range.setStartAfter( startContainer );
								else break;
							}

							node = range.startContainer;

							if ( node.type != CKEDITOR.NODE_ELEMENT )
								return node.getParent();

							node = node.getChild( range.startOffset );

							if ( !node || node.type != CKEDITOR.NODE_ELEMENT )
								node = range.startContainer;
							else
							{
								var child = node.getFirst();
								while (  child && child.type == CKEDITOR.NODE_ELEMENT )
								{
									node = child;
									child = child.getFirst();
								}
							}
						}
						else
						{
							node = range.startContainer;
							if ( node.type != CKEDITOR.NODE_ELEMENT )
								node = node.getParent();
						}

						node = node.$;
					}
			}

			return cache.startElement = ( node ? new CKEDITOR.dom.element( node ) : null );
		}
function ( ) { var cache = this . _ . cache ; if ( cache . startElement !== undefined ) return cache . startElement ; var node , sel = this . getNative ( ) ; switch ( this . getType ( ) ) { case CKEDITOR . SELECTION_ELEMENT : return this . getSelectedElement ( ) ; case CKEDITOR . SELECTION_TEXT : var range = this . getRanges ( ) [ 0 ] ; if ( range ) { if ( ! range . collapsed ) { range . optimize ( ) ; // Decrease the range content to exclude particial
 // selected node on the start which doesn't have
 // visual impact. ( #3231 )
 while ( 1 ) { var startContainer = range . startContainer , startOffset = range . startOffset ; // Limit the fix only to non-block elements.(#3950)
 if ( startOffset == ( startContainer . getChildCount ? startContainer . getChildCount ( ) : startContainer . getLength ( ) ) && ! startContainer . isBlockBoundary ( ) ) range . setStartAfter ( startContainer ) ; else break ; } node = range . startContainer ; if ( node . type != CKEDITOR . NODE_ELEMENT ) return node . getParent ( ) ; node = node . getChild ( range . startOffset ) ; if ( ! node || node . type != CKEDITOR . NODE_ELEMENT ) node = range . startContainer ; else { var child = node . getFirst ( ) ; while ( child && child . type == CKEDITOR . NODE_ELEMENT ) { node = child ; child = child . getFirst ( ) ; } } } else { node = range . startContainer ; if ( node . type != CKEDITOR . NODE_ELEMENT ) node = node . getParent ( ) ; } node = node . $ ; } } return cache . startElement = ( node ? new CKEDITOR . dom . element ( node ) : null ) ; }
Gets the DOM element in which the selection starts.
@returns {CKEDITOR.dom.element} The element at the beginning of the
selection.
@example
var element = editor.getSelection().<strong>getStartElement()</strong>;
alert( element.getName() );
Gets the DOM element in which the selection starts .