public/ckeditor/_source/core/dom/range.js
function( normalized )
		{
			var startContainer	= this.startContainer,
				endContainer	= this.endContainer;

			var startOffset	= this.startOffset,
				endOffset	= this.endOffset;

			var collapsed = this.collapsed;

			var child, previous;

			// If there is no range then get out of here.
			// It happens on initial load in Safari #962 and if the editor it's
			// hidden also in Firefox
			if ( !startContainer || !endContainer )
				return { start : 0, end : 0 };

			if ( normalized )
			{
				// Find out if the start is pointing to a text node that will
				// be normalized.
				if ( startContainer.type == CKEDITOR.NODE_ELEMENT )
				{
					child = startContainer.getChild( startOffset );

					// In this case, move the start information to that text
					// node.
					if ( child && child.type == CKEDITOR.NODE_TEXT
							&& startOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT )
					{
						startContainer = child;
						startOffset = 0;
					}

					// Get the normalized offset.
					if ( child && child.type == CKEDITOR.NODE_ELEMENT )
						startOffset = child.getIndex( 1 );
				}

				// Normalize the start.
				while ( startContainer.type == CKEDITOR.NODE_TEXT
						&& ( previous = startContainer.getPrevious() )
						&& previous.type == CKEDITOR.NODE_TEXT )
				{
					startContainer = previous;
					startOffset += previous.getLength();
				}

				// Process the end only if not normalized.
				if ( !collapsed )
				{
					// Find out if the start is pointing to a text node that
					// will be normalized.
					if ( endContainer.type == CKEDITOR.NODE_ELEMENT )
					{
						child = endContainer.getChild( endOffset );

						// In this case, move the start information to that
						// text node.
						if ( child && child.type == CKEDITOR.NODE_TEXT
								&& endOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT )
						{
							endContainer = child;
							endOffset = 0;
						}

						// Get the normalized offset.
						if ( child && child.type == CKEDITOR.NODE_ELEMENT )
							endOffset = child.getIndex( 1 );
					}

					// Normalize the end.
					while ( endContainer.type == CKEDITOR.NODE_TEXT
							&& ( previous = endContainer.getPrevious() )
							&& previous.type == CKEDITOR.NODE_TEXT )
					{
						endContainer = previous;
						endOffset += previous.getLength();
					}
				}
			}

			return {
				start		: startContainer.getAddress( normalized ),
				end			: collapsed ? null : endContainer.getAddress( normalized ),
				startOffset	: startOffset,
				endOffset	: endOffset,
				normalized	: normalized,
				collapsed	: collapsed,
				is2			: true		// It's a createBookmark2 bookmark.
			};
		}
function( normalized )
		{
			var startContainer	= this.startContainer,
				endContainer	= this.endContainer;

			var startOffset	= this.startOffset,
				endOffset	= this.endOffset;

			var collapsed = this.collapsed;

			var child, previous;

			// If there is no range then get out of here.
			// It happens on initial load in Safari #962 and if the editor it's
			// hidden also in Firefox
			if ( !startContainer || !endContainer )
				return { start : 0, end : 0 };

			if ( normalized )
			{
				// Find out if the start is pointing to a text node that will
				// be normalized.
				if ( startContainer.type == CKEDITOR.NODE_ELEMENT )
				{
					child = startContainer.getChild( startOffset );

					// In this case, move the start information to that text
					// node.
					if ( child && child.type == CKEDITOR.NODE_TEXT
							&& startOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT )
					{
						startContainer = child;
						startOffset = 0;
					}

					// Get the normalized offset.
					if ( child && child.type == CKEDITOR.NODE_ELEMENT )
						startOffset = child.getIndex( 1 );
				}

				// Normalize the start.
				while ( startContainer.type == CKEDITOR.NODE_TEXT
						&& ( previous = startContainer.getPrevious() )
						&& previous.type == CKEDITOR.NODE_TEXT )
				{
					startContainer = previous;
					startOffset += previous.getLength();
				}

				// Process the end only if not normalized.
				if ( !collapsed )
				{
					// Find out if the start is pointing to a text node that
					// will be normalized.
					if ( endContainer.type == CKEDITOR.NODE_ELEMENT )
					{
						child = endContainer.getChild( endOffset );

						// In this case, move the start information to that
						// text node.
						if ( child && child.type == CKEDITOR.NODE_TEXT
								&& endOffset > 0 && child.getPrevious().type == CKEDITOR.NODE_TEXT )
						{
							endContainer = child;
							endOffset = 0;
						}

						// Get the normalized offset.
						if ( child && child.type == CKEDITOR.NODE_ELEMENT )
							endOffset = child.getIndex( 1 );
					}

					// Normalize the end.
					while ( endContainer.type == CKEDITOR.NODE_TEXT
							&& ( previous = endContainer.getPrevious() )
							&& previous.type == CKEDITOR.NODE_TEXT )
					{
						endContainer = previous;
						endOffset += previous.getLength();
					}
				}
			}

			return {
				start		: startContainer.getAddress( normalized ),
				end			: collapsed ? null : endContainer.getAddress( normalized ),
				startOffset	: startOffset,
				endOffset	: endOffset,
				normalized	: normalized,
				collapsed	: collapsed,
				is2			: true		// It's a createBookmark2 bookmark.
			};
		}
function ( normalized ) { var startContainer = this . startContainer , endContainer = this . endContainer ; var startOffset = this . startOffset , endOffset = this . endOffset ; var collapsed = this . collapsed ; var child , previous ; // If there is no range then get out of here.
 // It happens on initial load in Safari #962 and if the editor it's
 // hidden also in Firefox
 if ( ! startContainer || ! endContainer ) return { start : 0 , end : 0 } ; if ( normalized ) { // Find out if the start is pointing to a text node that will
 // be normalized.
 if ( startContainer . type == CKEDITOR . NODE_ELEMENT ) { child = startContainer . getChild ( startOffset ) ; // In this case, move the start information to that text
 // node.
 if ( child && child . type == CKEDITOR . NODE_TEXT && startOffset > 0 && child . getPrevious ( ) . type == CKEDITOR . NODE_TEXT ) { startContainer = child ; startOffset = 0 ; } // Get the normalized offset.
 if ( child && child . type == CKEDITOR . NODE_ELEMENT ) startOffset = child . getIndex ( 1 ) ; } // Normalize the start.
 while ( startContainer . type == CKEDITOR . NODE_TEXT && ( previous = startContainer . getPrevious ( ) ) && previous . type == CKEDITOR . NODE_TEXT ) { startContainer = previous ; startOffset += previous . getLength ( ) ; } // Process the end only if not normalized.
 if ( ! collapsed ) { // Find out if the start is pointing to a text node that
 // will be normalized.
 if ( endContainer . type == CKEDITOR . NODE_ELEMENT ) { child = endContainer . getChild ( endOffset ) ; // In this case, move the start information to that
 // text node.
 if ( child && child . type == CKEDITOR . NODE_TEXT && endOffset > 0 && child . getPrevious ( ) . type == CKEDITOR . NODE_TEXT ) { endContainer = child ; endOffset = 0 ; } // Get the normalized offset.
 if ( child && child . type == CKEDITOR . NODE_ELEMENT ) endOffset = child . getIndex ( 1 ) ; } // Normalize the end.
 while ( endContainer . type == CKEDITOR . NODE_TEXT && ( previous = endContainer . getPrevious ( ) ) && previous . type == CKEDITOR . NODE_TEXT ) { endContainer = previous ; endOffset += previous . getLength ( ) ; } } } return { start : startContainer . getAddress ( normalized ) , end : collapsed ? null : endContainer . getAddress ( normalized ) , startOffset : startOffset , endOffset : endOffset , normalized : normalized , collapsed : collapsed , is2 : true // It's a createBookmark2 bookmark.
 } ; }
Creates a "non intrusive" and "mutation sensible" bookmark. This
kind of bookmark should be used only when the DOM is supposed to
remain stable after its creation.
@param {Boolean} [normalized] Indicates that the bookmark must
normalized. When normalized, the successive text nodes are
considered a single node. To sucessful load a normalized
bookmark, the DOM tree must be also normalized before calling
moveToBookmark.
@returns {Object} An object representing the bookmark.
Creates a non intrusive and mutation sensible bookmark . This kind of bookmark should be used only when the DOM is supposed to remain stable after its creation .