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 * DocumentFragment is a "lightweight" or "minimal" Document object. It is 7 * commonly used to extract a portion of a document's tree or to create a new 8 * fragment of a document. Various operations may take DocumentFragment objects 9 * as arguments and results in all the child nodes of the DocumentFragment being 10 * moved to the child list of this node. 11 * 12 * @param {Object} ownerDocument 13 */ 14 CKEDITOR.dom.documentFragment = function( ownerDocument ) 15 { 16 ownerDocument = ownerDocument || CKEDITOR.document; 17 this.$ = ownerDocument.$.createDocumentFragment(); 18 }; 19 20 CKEDITOR.tools.extend( CKEDITOR.dom.documentFragment.prototype, 21 CKEDITOR.dom.element.prototype, 22 { 23 type : CKEDITOR.NODE_DOCUMENT_FRAGMENT, 24 insertAfterNode : function( node ) 25 { 26 node = node.$; 27 node.parentNode.insertBefore( this.$, node.nextSibling ); 28 } 29 }, 30 true, 31 { 32 'append' : 1, 33 'getFirst' : 1, 34 'getLast' : 1, 35 'appendTo' : 1, 36 'moveChildren' : 1, 37 'insertBefore' : 1, 38 'insertAfterNode' : 1, 39 'replace' : 1, 40 'trim' : 1, 41 'ltrim' : 1, 42 'rtrim' : 1, 43 'getDocument' : 1, 44 'getChildCount' : 1, 45 'getChild' : 1, 46 'getChildren' : 1 47 } ); 48