lib/utils/common.js
function(text, start, end) {
			var rng = range.create(start, end);
			
			var reSpace = /[\s\n\r\u00a0]/;
			// narrow down selection until first non-space character
			while (rng.start < rng.end) {
				if (!reSpace.test(text.charAt(rng.start)))
					break;
					
				rng.start++;
			}
			
			while (rng.end > rng.start) {
				rng.end--;
				if (!reSpace.test(text.charAt(rng.end))) {
					rng.end++;
					break;
				}
			}
			
			return rng;
		}
function(text, start, end) {
			var rng = range.create(start, end);
			
			var reSpace = /[\s\n\r\u00a0]/;
			// narrow down selection until first non-space character
			while (rng.start < rng.end) {
				if (!reSpace.test(text.charAt(rng.start)))
					break;
					
				rng.start++;
			}
			
			while (rng.end > rng.start) {
				rng.end--;
				if (!reSpace.test(text.charAt(rng.end))) {
					rng.end++;
					break;
				}
			}
			
			return rng;
		}
function ( text , start , end ) { var rng = range . create ( start , end ) ; var reSpace = / [\s\n\r\u00a0] / ; // narrow down selection until first non-space character while ( rng . start < rng . end ) { if ( ! reSpace . test ( text . charAt ( rng . start ) ) ) break ; rng . start ++ ; } while ( rng . end > rng . start ) { rng . end -- ; if ( ! reSpace . test ( text . charAt ( rng . end ) ) ) { rng . end ++ ; break ; } } return rng ; }
Narrows down text range, adjusting selection to non-space characters
@param {String} text
@param {Number} start Starting range in <code>text</code> where
slection should be adjusted. Can also be any object that is accepted
by <code>Range</code> class
@return {Range}
Narrows down text range adjusting selection to non - space characters