public/ckeditor/4.4dev/core/filter.js
function removeElement( element, enterTag, toBeChecked ) {
		var name = element.name;

		if ( DTD.$empty[ name ] || !element.children.length ) {
			// Special case - hr in br mode should be replaced with br, not removed.
			if ( name == 'hr' && enterTag == 'br' )
				element.replaceWith( createBr() );
			else {
				// Parent might become an empty inline specified in $removeEmpty or empty a[href].
				if ( element.parent )
					toBeChecked.push( { check: 'it', el: element.parent } );

				element.remove();
			}
		} else if ( DTD.$block[ name ] || name == 'tr' ) {
			if ( enterTag == 'br' )
				stripBlockBr( element, toBeChecked );
			else
				stripBlock( element, enterTag, toBeChecked );
		}
		// Special case - elements that may contain CDATA
		// should be removed completely. <script> is handled
		// by processProtectedElement().
		else if ( name == 'style' )
			element.remove();
		// The rest of inline elements. May also be the last resort
		// for some special elements.
		else {
			// Parent might become an empty inline specified in $removeEmpty or empty a[href].
			if ( element.parent )
				toBeChecked.push( { check: 'it', el: element.parent } );
			element.replaceWithChildren();
		}
	}
function removeElement( element, enterTag, toBeChecked ) {
		var name = element.name;

		if ( DTD.$empty[ name ] || !element.children.length ) {
			// Special case - hr in br mode should be replaced with br, not removed.
			if ( name == 'hr' && enterTag == 'br' )
				element.replaceWith( createBr() );
			else {
				// Parent might become an empty inline specified in $removeEmpty or empty a[href].
				if ( element.parent )
					toBeChecked.push( { check: 'it', el: element.parent } );

				element.remove();
			}
		} else if ( DTD.$block[ name ] || name == 'tr' ) {
			if ( enterTag == 'br' )
				stripBlockBr( element, toBeChecked );
			else
				stripBlock( element, enterTag, toBeChecked );
		}
		// Special case - elements that may contain CDATA
		// should be removed completely. <script> is handled
		// by processProtectedElement().
		else if ( name == 'style' )
			element.remove();
		// The rest of inline elements. May also be the last resort
		// for some special elements.
		else {
			// Parent might become an empty inline specified in $removeEmpty or empty a[href].
			if ( element.parent )
				toBeChecked.push( { check: 'it', el: element.parent } );
			element.replaceWithChildren();
		}
	}
function removeElement ( element , enterTag , toBeChecked ) { var name = element . name ; if ( DTD . $empty [ name ] || ! element . children . length ) { // Special case - hr in br mode should be replaced with br, not removed. if ( name == 'hr' && enterTag == 'br' ) element . replaceWith ( createBr ( ) ) ; else { // Parent might become an empty inline specified in $removeEmpty or empty a[href]. if ( element . parent ) toBeChecked . push ( { check : 'it' , el : element . parent } ) ; element . remove ( ) ; } } else if ( DTD . $block [ name ] || name == 'tr' ) { if ( enterTag == 'br' ) stripBlockBr ( element , toBeChecked ) ; else stripBlock ( element , enterTag , toBeChecked ) ; } // Special case - elements that may contain CDATA // should be removed completely. <script> is handled // by processProtectedElement(). else if ( name == 'style' ) element . remove ( ) ; // The rest of inline elements. May also be the last resort // for some special elements. else { // Parent might become an empty inline specified in $removeEmpty or empty a[href]. if ( element . parent ) toBeChecked . push ( { check : 'it' , el : element . parent } ) ; element . replaceWithChildren ( ) ; } }
Try to remove element in the best possible way.  @param {Array} toBeChecked After executing this function this array will contain elements that should be checked because they were marked as potentially: * in wrong context (e.g. li in body), * empty elements from $removeEmpty, * incorrect img/a/other element validated by validateElement().
Try to remove element in the best possible way .