6152031099b97a5065db9f826db24a6c4ebc8563
[ckeditor.git] / _source / core / dom / documentfragment.js
1 /*
2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
4 */
5
6 /**
7 * @class DocumentFragment is a "lightweight" or "minimal" Document object. It is
8 * commonly used to extract a portion of a document's tree or to create a new
9 * fragment of a document. Various operations may take DocumentFragment objects
10 * as arguments and results in all the child nodes of the DocumentFragment being
11 * moved to the child list of this node.
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 'appendBogus' : 1,
34 'getFirst' : 1,
35 'getLast' : 1,
36 'appendTo' : 1,
37 'moveChildren' : 1,
38 'insertBefore' : 1,
39 'insertAfterNode' : 1,
40 'replace' : 1,
41 'trim' : 1,
42 'type' : 1,
43 'ltrim' : 1,
44 'rtrim' : 1,
45 'getDocument' : 1,
46 'getChildCount' : 1,
47 'getChild' : 1,
48 'getChildren' : 1
49 } );