public/ckeditor/_source/plugins/entities/plugin.js
function buildTable( entities, reverse )
	{
		var table = {},
			regex = [];

		// Entities that the browsers DOM don't transform to the final char
		// automatically.
		var specialTable =
			{
				nbsp	: '\u00A0',		// IE | FF
				shy		: '\u00AD',		// IE
				gt		: '\u003E',		// IE | FF |   --   | Opera
				lt		: '\u003C',		// IE | FF | Safari | Opera
				amp : '\u0026'		// ALL
			};

		entities = entities.replace( /\b(nbsp|shy|gt|lt|amp)(?:,|$)/g, function( match, entity )
			{
				var org = reverse ? '&' + entity + ';' : specialTable[ entity ],
					result = reverse ? specialTable[ entity ] : '&' + entity + ';';

				table[ org ] = result;
				regex.push( org );
				return '';
			});

		if ( !reverse && entities )
		{
			// Transforms the entities string into an array.
			entities = entities.split( ',' );

			// Put all entities inside a DOM element, transforming them to their
			// final chars.
			var div = document.createElement( 'div' ),
				chars;
			div.innerHTML = '&' + entities.join( ';&' ) + ';';
			chars = div.innerHTML;
			div = null;

			// Add all chars to the table.
			for ( var i = 0 ; i < chars.length ; i++ )
			{
				var charAt = chars.charAt( i );
				table[ charAt ] = '&' + entities[ i ] + ';';
				regex.push( charAt );
			}
		}

		table.regex = regex.join( reverse ? '|' : '' );

		return table;
	}
function buildTable( entities, reverse )
	{
		var table = {},
			regex = [];

		// Entities that the browsers DOM don't transform to the final char
		// automatically.
		var specialTable =
			{
				nbsp	: '\u00A0',		// IE | FF
				shy		: '\u00AD',		// IE
				gt		: '\u003E',		// IE | FF |   --   | Opera
				lt		: '\u003C',		// IE | FF | Safari | Opera
				amp : '\u0026'		// ALL
			};

		entities = entities.replace( /\b(nbsp|shy|gt|lt|amp)(?:,|$)/g, function( match, entity )
			{
				var org = reverse ? '&' + entity + ';' : specialTable[ entity ],
					result = reverse ? specialTable[ entity ] : '&' + entity + ';';

				table[ org ] = result;
				regex.push( org );
				return '';
			});

		if ( !reverse && entities )
		{
			// Transforms the entities string into an array.
			entities = entities.split( ',' );

			// Put all entities inside a DOM element, transforming them to their
			// final chars.
			var div = document.createElement( 'div' ),
				chars;
			div.innerHTML = '&' + entities.join( ';&' ) + ';';
			chars = div.innerHTML;
			div = null;

			// Add all chars to the table.
			for ( var i = 0 ; i < chars.length ; i++ )
			{
				var charAt = chars.charAt( i );
				table[ charAt ] = '&' + entities[ i ] + ';';
				regex.push( charAt );
			}
		}

		table.regex = regex.join( reverse ? '|' : '' );

		return table;
	}
function buildTable ( entities , reverse ) { var table = { } , regex = [ ] ; // Entities that the browsers DOM don't transform to the final char
 // automatically.
 var specialTable = { nbsp : '\u00A0' , // IE | FF
 shy : '\u00AD' , // IE
 gt : '\u003E' , // IE | FF |   --   | Opera
 lt : '\u003C' , // IE | FF | Safari | Opera
 amp : '\u0026' // ALL
 } ; entities = entities . replace ( / \b(nbsp|shy|gt|lt|amp)(?:,|$) / g , function ( match , entity ) { var org = reverse ? '&' + entity + ';' : specialTable [ entity ] , result = reverse ? specialTable [ entity ] : '&' + entity + ';' ; table [ org ] = result ; regex . push ( org ) ; return '' ; } ) ; if ( ! reverse && entities ) { // Transforms the entities string into an array.
 entities = entities . split ( ',' ) ; // Put all entities inside a DOM element, transforming them to their
 // final chars.
 var div = document . createElement ( 'div' ) , chars ; div . innerHTML = '&' + entities . join ( ';&' ) + ';' ; chars = div . innerHTML ; div = null ; // Add all chars to the table.
 for ( var i = 0 ; i < chars . length ; i ++ ) { var charAt = chars . charAt ( i ) ; table [ charAt ] = '&' + entities [ i ] + ';' ; regex . push ( charAt ) ; } } table . regex = regex . join ( reverse ? '|' : '' ) ; return table ; }
Create a mapping table between one character and its entity form from a list of entity names.
@param reverse {Boolean} Whether to create a reverse map from the entity string form to an actual character.
Create a mapping table between one character and its entity form from a list of entity names .