function(elems)
	{
	    // Known block elements for handling linefeeds (list is not complete)
		var blocks = ['BLOCKQUOTE', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'OL', 'P', 'PRE', 'TABLE', 'UL'];
		var ret = [];
		
		function doExtract(elts)
		{
			// Single break should be ignored
			if (elts.length == 1 && (elts[0].nodeName == 'BR' ||
				elts[0].innerHTML == '\n'))
			{
				return;
			}
			
		    for (var i = 0; i < elts.length; i++)
		    {
		        var elem = elts[i];

				// DIV with a br or linefeed forces a linefeed
				if (elem.nodeName == 'BR' || elem.innerHTML == '\n' ||
					((elts.length == 1 || i == 0) && (elem.nodeName == 'DIV' &&
					elem.innerHTML.toLowerCase() == '<br>')))
		    	{
	    			ret.push('\n');
		    	}
				else
				{
			        if (elem.nodeType === 3 || elem.nodeType === 4)
			        {
			        	if (elem.nodeValue.length > 0)
			        	{
			        		ret.push(elem.nodeValue);
			        	}
			        }
			        else if (elem.nodeType !== 8 && elem.childNodes.length > 0)
					{
						doExtract(elem.childNodes);
					}
			        
	        		if (i < elts.length - 1 && mxUtils.indexOf(blocks, elts[i + 1].nodeName) >= 0)
	        		{
	        			ret.push('\n');		
	        		}
				}
		    }
		};
		
		doExtract(elems);
	    
	    return ret.join('');
	}
function(elems)
	{
	    // Known block elements for handling linefeeds (list is not complete)
		var blocks = ['BLOCKQUOTE', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'OL', 'P', 'PRE', 'TABLE', 'UL'];
		var ret = [];
		
		function doExtract(elts)
		{
			// Single break should be ignored
			if (elts.length == 1 && (elts[0].nodeName == 'BR' ||
				elts[0].innerHTML == '\n'))
			{
				return;
			}
			
		    for (var i = 0; i < elts.length; i++)
		    {
		        var elem = elts[i];

				// DIV with a br or linefeed forces a linefeed
				if (elem.nodeName == 'BR' || elem.innerHTML == '\n' ||
					((elts.length == 1 || i == 0) && (elem.nodeName == 'DIV' &&
					elem.innerHTML.toLowerCase() == '<br>')))
		    	{
	    			ret.push('\n');
		    	}
				else
				{
			        if (elem.nodeType === 3 || elem.nodeType === 4)
			        {
			        	if (elem.nodeValue.length > 0)
			        	{
			        		ret.push(elem.nodeValue);
			        	}
			        }
			        else if (elem.nodeType !== 8 && elem.childNodes.length > 0)
					{
						doExtract(elem.childNodes);
					}
			        
	        		if (i < elts.length - 1 && mxUtils.indexOf(blocks, elts[i + 1].nodeName) >= 0)
	        		{
	        			ret.push('\n');		
	        		}
				}
		    }
		};
		
		doExtract(elems);
	    
	    return ret.join('');
	}
function ( elems ) { // Known block elements for handling linefeeds (list is not complete) var blocks = [ 'BLOCKQUOTE' , 'DIV' , 'H1' , 'H2' , 'H3' , 'H4' , 'H5' , 'H6' , 'OL' , 'P' , 'PRE' , 'TABLE' , 'UL' ] ; var ret = [ ] ; function doExtract ( elts ) { // Single break should be ignored if ( elts . length == 1 && ( elts [ 0 ] . nodeName == 'BR' || elts [ 0 ] . innerHTML == '\n' ) ) { return ; } for ( var i = 0 ; i < elts . length ; i ++ ) { var elem = elts [ i ] ; // DIV with a br or linefeed forces a linefeed if ( elem . nodeName == 'BR' || elem . innerHTML == '\n' || ( ( elts . length == 1 || i == 0 ) && ( elem . nodeName == 'DIV' && elem . innerHTML . toLowerCase ( ) == '<br>' ) ) ) { ret . push ( '\n' ) ; } else { if ( elem . nodeType === 3 || elem . nodeType === 4 ) { if ( elem . nodeValue . length > 0 ) { ret . push ( elem . nodeValue ) ; } } else if ( elem . nodeType !== 8 && elem . childNodes . length > 0 ) { doExtract ( elem . childNodes ) ; } if ( i < elts . length - 1 && mxUtils . indexOf ( blocks , elts [ i + 1 ] . nodeName ) >= 0 ) { ret . push ( '\n' ) ; } } } } ; doExtract ( elems ) ; return ret . join ( '' ) ; }
Function: extractTextWithWhitespace

Returns the text content of the specified node.

Parameters:

elems - DOM nodes to return the text for.
Function : extractTextWithWhitespace
Returns an array of elements that are not part of a block