1 /*
  2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
  3 For licensing, see LICENSE.html or http://ckeditor.com/license
  4 */
  5
  6 CKEDITOR.dom.documentFragment = function( ownerDocument )
  7 {
  8 	this.$ = CKEDITOR.env.ie ? ownerDocument.$.createElement( 'div' ) : ownerDocument.$.createDocumentFragment();
  9 };
 10
 11 (function()
 12 {
 13 	var elementPrototype = CKEDITOR.dom.element.prototype;
 14
 15 	CKEDITOR.dom.documentFragment.prototype =
 16 	{
 17 		type : CKEDITOR.NODE_DOCUMENT_FRAGMENT,
 18
 19 		append : elementPrototype.append,
 20
 21 		appendTo : function( targetElement )
 22 		{
 23 			if ( CKEDITOR.env.ie )
 24 				elementPrototype.moveChildren.call( this, targetElement );
 25 			else
 26 				targetElement.$.appendChild( this.$ );
 27 		},
 28
 29 		insertAfterNode : function( node )
 30 		{
 31 			var $ = this.$;
 32 			var $node = node.$;
 33 			var $parent = $node.parentNode;
 34
 35 			if ( CKEDITOR.env.ie )
 36 			{
 37 				for ( var child ; child = $.lastChild ; )
 38 					$parent.insertBefore( $.removeChild( child ), $node.nextSibling );
 39 			}
 40 			else
 41 				$parent.insertBefore( $, $node.nextSibling );
 42 		}
 43 	};
 44 })();
 45