JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.0
[ckeditor.git] / _source / core / dom / documentfragment.js
diff --git a/_source/core/dom/documentfragment.js b/_source/core/dom/documentfragment.js
new file mode 100644 (file)
index 0000000..a449441
--- /dev/null
@@ -0,0 +1,49 @@
+/*\r
+Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+For licensing, see LICENSE.html or http://ckeditor.com/license\r
+*/\r
+/**\r
+ * DocumentFragment is a "lightweight" or "minimal" Document object. It is\r
+ * commonly used to extract a portion of a document's tree or to create a new\r
+ * fragment of a document. Various operations may take DocumentFragment objects\r
+ * as arguments and results in all the child nodes of the DocumentFragment being\r
+ * moved to the child list of this node.\r
+ *\r
+ * @param {Object} ownerDocument\r
+ */\r
+CKEDITOR.dom.documentFragment = function( ownerDocument )\r
+{\r
+       ownerDocument = ownerDocument || CKEDITOR.document;\r
+       this.$ = ownerDocument.$.createDocumentFragment();\r
+};\r
+\r
+CKEDITOR.tools.extend( CKEDITOR.dom.documentFragment.prototype,\r
+       CKEDITOR.dom.element.prototype,\r
+       {\r
+               type : CKEDITOR.NODE_DOCUMENT_FRAGMENT,\r
+               insertAfterNode : function( node )\r
+               {\r
+                       node = node.$;\r
+                       node.parentNode.insertBefore( this.$, node.nextSibling );\r
+               }\r
+       },\r
+       true,\r
+       {\r
+               'append' : 1,\r
+               'appendBogus' : 1,\r
+               'getFirst' : 1,\r
+               'getLast' : 1,\r
+               'appendTo' : 1,\r
+               'moveChildren' : 1,\r
+               'insertBefore' : 1,\r
+               'insertAfterNode' : 1,\r
+               'replace' : 1,\r
+               'trim' : 1,\r
+               'type' : 1,\r
+               'ltrim' : 1,\r
+               'rtrim' : 1,\r
+               'getDocument' : 1,\r
+               'getChildCount' : 1,\r
+               'getChild' : 1,\r
+               'getChildren' : 1\r
+       } );\r