public/ckeditor/4.4dev/core/htmlparser/fragment.js
function addElement( element, target, moveCurrent ) {
			target = target || currentNode || root;

			// Current element might be mangled by fix body below,
			// save it for restore later.
			var savedCurrent = currentNode;

			// Ignore any element that has already been added.
			if ( element.previous === undefined ) {
				if ( checkAutoParagraphing( target, element ) ) {
					// Create a <p> in the fragment.
					currentNode = target;
					parser.onTagOpen( fixingBlock, {} );

					// The new target now is the <p>.
					element.returnPoint = target = currentNode;
				}

				removeTailWhitespace( element );

				// Avoid adding empty inline.
				if ( !( isRemoveEmpty( element ) && !element.children.length ) )
					target.add( element );

				if ( element.name == 'pre' )
					inPre = false;

				if ( element.name == 'textarea' )
					inTextarea = false;
			}

			if ( element.returnPoint ) {
				currentNode = element.returnPoint;
				delete element.returnPoint;
			} else {
				currentNode = moveCurrent ? target : savedCurrent;
			}
		}
function addElement( element, target, moveCurrent ) {
			target = target || currentNode || root;

			// Current element might be mangled by fix body below,
			// save it for restore later.
			var savedCurrent = currentNode;

			// Ignore any element that has already been added.
			if ( element.previous === undefined ) {
				if ( checkAutoParagraphing( target, element ) ) {
					// Create a <p> in the fragment.
					currentNode = target;
					parser.onTagOpen( fixingBlock, {} );

					// The new target now is the <p>.
					element.returnPoint = target = currentNode;
				}

				removeTailWhitespace( element );

				// Avoid adding empty inline.
				if ( !( isRemoveEmpty( element ) && !element.children.length ) )
					target.add( element );

				if ( element.name == 'pre' )
					inPre = false;

				if ( element.name == 'textarea' )
					inTextarea = false;
			}

			if ( element.returnPoint ) {
				currentNode = element.returnPoint;
				delete element.returnPoint;
			} else {
				currentNode = moveCurrent ? target : savedCurrent;
			}
		}
function addElement ( element , target , moveCurrent ) { target = target || currentNode || root ; // Current element might be mangled by fix body below, // save it for restore later. var savedCurrent = currentNode ; // Ignore any element that has already been added. if ( element . previous === undefined ) { if ( checkAutoParagraphing ( target , element ) ) { // Create a <p> in the fragment. currentNode = target ; parser . onTagOpen ( fixingBlock , { } ) ; // The new target now is the <p>. element . returnPoint = target = currentNode ; } removeTailWhitespace ( element ) ; // Avoid adding empty inline. if ( ! ( isRemoveEmpty ( element ) && ! element . children . length ) ) target . add ( element ) ; if ( element . name == 'pre' ) inPre = false ; if ( element . name == 'textarea' ) inTextarea = false ; } if ( element . returnPoint ) { currentNode = element . returnPoint ; delete element . returnPoint ; } else { currentNode = moveCurrent ? target : savedCurrent ; } }
Beside of simply append specified element to target, this function also takes care of other dirty lifts like forcing block in body, trimming spaces at the block boundaries etc.  @param {Element} element  The element to be added as the last child of {@link target}. @param {Element} target The parent element to relieve the new node. @param {Boolean} [moveCurrent=false] Don't change the "currentNode" global unless there's a return point node specified on the element, otherwise move current onto {@link target} node.
Beside of simply append specified element to target this function also takes care of other dirty lifts like forcing block in body trimming spaces at the block boundaries etc .