JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.1
[ckeditor.git] / _source / core / dom / documentfragment.js
1 /*\r
2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license\r
4 */\r
5 /**\r
6  * DocumentFragment is a "lightweight" or "minimal" Document object. It is\r
7  * commonly used to extract a portion of a document's tree or to create a new\r
8  * fragment of a document. Various operations may take DocumentFragment objects\r
9  * as arguments and results in all the child nodes of the DocumentFragment being\r
10  * moved to the child list of this node.\r
11  *\r
12  * @param {Object} ownerDocument\r
13  */\r
14 CKEDITOR.dom.documentFragment = function( ownerDocument )\r
15 {\r
16         ownerDocument = ownerDocument || CKEDITOR.document;\r
17         this.$ = ownerDocument.$.createDocumentFragment();\r
18 };\r
19 \r
20 CKEDITOR.tools.extend( CKEDITOR.dom.documentFragment.prototype,\r
21         CKEDITOR.dom.element.prototype,\r
22         {\r
23                 type : CKEDITOR.NODE_DOCUMENT_FRAGMENT,\r
24                 insertAfterNode : function( node )\r
25                 {\r
26                         node = node.$;\r
27                         node.parentNode.insertBefore( this.$, node.nextSibling );\r
28                 }\r
29         },\r
30         true,\r
31         {\r
32                 'append' : 1,\r
33                 'appendBogus' : 1,\r
34                 'getFirst' : 1,\r
35                 'getLast' : 1,\r
36                 'appendTo' : 1,\r
37                 'moveChildren' : 1,\r
38                 'insertBefore' : 1,\r
39                 'insertAfterNode' : 1,\r
40                 'replace' : 1,\r
41                 'trim' : 1,\r
42                 'type' : 1,\r
43                 'ltrim' : 1,\r
44                 'rtrim' : 1,\r
45                 'getDocument' : 1,\r
46                 'getChildCount' : 1,\r
47                 'getChild' : 1,\r
48                 'getChildren' : 1\r
49         } );\r