public/ckeditor/4.4dev/core/dom/rangelist.js
function() {
			var rangeList = this,
				bookmark = CKEDITOR.dom.walker.bookmark(),
				bookmarks = [],
				current;

			return {
				/**
				 * Retrieves the next range in the list.
				 *
				 * @member CKEDITOR.dom.rangeListIterator
				 * @param {Boolean} [mergeConsequent=false] Whether join two adjacent
				 * ranges into single, e.g. consequent table cells.
				 */
				getNextRange: function( mergeConsequent ) {
					current = current === undefined ? 0 : current + 1;

					var range = rangeList[ current ];

					// Multiple ranges might be mangled by each other.
					if ( range && rangeList.length > 1 ) {
						// Bookmarking all other ranges on the first iteration,
						// the range correctness after it doesn't matter since we'll
						// restore them before the next iteration.
						if ( !current ) {
							// Make sure bookmark correctness by reverse processing.
							for ( var i = rangeList.length - 1; i >= 0; i-- )
								bookmarks.unshift( rangeList[ i ].createBookmark( true ) );
						}

						if ( mergeConsequent ) {
							// Figure out how many ranges should be merged.
							var mergeCount = 0;
							while ( rangeList[ current + mergeCount + 1 ] ) {
								var doc = range.document,
									found = 0,
									left = doc.getById( bookmarks[ mergeCount ].endNode ),
									right = doc.getById( bookmarks[ mergeCount + 1 ].startNode ),
									next;

								// Check subsequent range.
								while ( 1 ) {
									next = left.getNextSourceNode( false );
									if ( !right.equals( next ) ) {
										// This could be yet another bookmark or
										// walking across block boundaries.
										if ( bookmark( next ) || ( next.type == CKEDITOR.NODE_ELEMENT && next.isBlockBoundary() ) ) {
											left = next;
											continue;
										}
									} else {
										found = 1;
									}

									break;
								}

								if ( !found )
									break;

								mergeCount++;
							}
						}

						range.moveToBookmark( bookmarks.shift() );

						// Merge ranges finally after moving to bookmarks.
						while ( mergeCount-- ) {
							next = rangeList[ ++current ];
							next.moveToBookmark( bookmarks.shift() );
							range.setEnd( next.endContainer, next.endOffset );
						}
					}

					return range;
				}
			};
		}
function() {
			var rangeList = this,
				bookmark = CKEDITOR.dom.walker.bookmark(),
				bookmarks = [],
				current;

			return {
				/**
				 * Retrieves the next range in the list.
				 *
				 * @member CKEDITOR.dom.rangeListIterator
				 * @param {Boolean} [mergeConsequent=false] Whether join two adjacent
				 * ranges into single, e.g. consequent table cells.
				 */
				getNextRange: function( mergeConsequent ) {
					current = current === undefined ? 0 : current + 1;

					var range = rangeList[ current ];

					// Multiple ranges might be mangled by each other.
					if ( range && rangeList.length > 1 ) {
						// Bookmarking all other ranges on the first iteration,
						// the range correctness after it doesn't matter since we'll
						// restore them before the next iteration.
						if ( !current ) {
							// Make sure bookmark correctness by reverse processing.
							for ( var i = rangeList.length - 1; i >= 0; i-- )
								bookmarks.unshift( rangeList[ i ].createBookmark( true ) );
						}

						if ( mergeConsequent ) {
							// Figure out how many ranges should be merged.
							var mergeCount = 0;
							while ( rangeList[ current + mergeCount + 1 ] ) {
								var doc = range.document,
									found = 0,
									left = doc.getById( bookmarks[ mergeCount ].endNode ),
									right = doc.getById( bookmarks[ mergeCount + 1 ].startNode ),
									next;

								// Check subsequent range.
								while ( 1 ) {
									next = left.getNextSourceNode( false );
									if ( !right.equals( next ) ) {
										// This could be yet another bookmark or
										// walking across block boundaries.
										if ( bookmark( next ) || ( next.type == CKEDITOR.NODE_ELEMENT && next.isBlockBoundary() ) ) {
											left = next;
											continue;
										}
									} else {
										found = 1;
									}

									break;
								}

								if ( !found )
									break;

								mergeCount++;
							}
						}

						range.moveToBookmark( bookmarks.shift() );

						// Merge ranges finally after moving to bookmarks.
						while ( mergeCount-- ) {
							next = rangeList[ ++current ];
							next.moveToBookmark( bookmarks.shift() );
							range.setEnd( next.endContainer, next.endOffset );
						}
					}

					return range;
				}
			};
		}
function ( ) { var rangeList = this , bookmark = CKEDITOR . dom . walker . bookmark ( ) , bookmarks = [ ] , current ; return { /**
				 * Retrieves the next range in the list.
				 *
				 * @member CKEDITOR.dom.rangeListIterator
				 * @param {Boolean} [mergeConsequent=false] Whether join two adjacent
				 * ranges into single, e.g. consequent table cells.
				 */ getNextRange : function ( mergeConsequent ) { current = current === undefined ? 0 : current + 1 ; var range = rangeList [ current ] ; // Multiple ranges might be mangled by each other. if ( range && rangeList . length > 1 ) { // Bookmarking all other ranges on the first iteration, // the range correctness after it doesn't matter since we'll // restore them before the next iteration. if ( ! current ) { // Make sure bookmark correctness by reverse processing. for ( var i = rangeList . length - 1 ; i >= 0 ; i -- ) bookmarks . unshift ( rangeList [ i ] . createBookmark ( true ) ) ; } if ( mergeConsequent ) { // Figure out how many ranges should be merged. var mergeCount = 0 ; while ( rangeList [ current + mergeCount + 1 ] ) { var doc = range . document , found = 0 , left = doc . getById ( bookmarks [ mergeCount ] . endNode ) , right = doc . getById ( bookmarks [ mergeCount + 1 ] . startNode ) , next ; // Check subsequent range. while ( 1 ) { next = left . getNextSourceNode ( false ) ; if ( ! right . equals ( next ) ) { // This could be yet another bookmark or // walking across block boundaries. if ( bookmark ( next ) || ( next . type == CKEDITOR . NODE_ELEMENT && next . isBlockBoundary ( ) ) ) { left = next ; continue ; } } else { found = 1 ; } break ; } if ( ! found ) break ; mergeCount ++ ; } } range . moveToBookmark ( bookmarks . shift ( ) ) ; // Merge ranges finally after moving to bookmarks. while ( mergeCount -- ) { next = rangeList [ ++ current ] ; next . moveToBookmark ( bookmarks . shift ( ) ) ; range . setEnd ( next . endContainer , next . endOffset ) ; } } return range ; } } ; }
Creates an instance of the rangeList iterator, it should be used
only when the ranges processing could be DOM intrusive, which
means it may pollute and break other ranges in this list.
Otherwise, it's enough to just iterate over this array in a for loop.

@returns {CKEDITOR.dom.rangeListIterator}
Creates an instance of the rangeList iterator it should be used only when the ranges processing could be DOM intrusive which means it may pollute and break other ranges in this list . Otherwise it s enough to just iterate over this array in a for loop .