documentfragment.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. * @class 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. * @param {Object} ownerDocument
  12. */
  13. CKEDITOR.dom.documentFragment = function( ownerDocument )
  14. {
  15. ownerDocument = ownerDocument || CKEDITOR.document;
  16. this.$ = ownerDocument.$.createDocumentFragment();
  17. };
  18. CKEDITOR.tools.extend( CKEDITOR.dom.documentFragment.prototype,
  19. CKEDITOR.dom.element.prototype,
  20. {
  21. type : CKEDITOR.NODE_DOCUMENT_FRAGMENT,
  22. insertAfterNode : function( node )
  23. {
  24. node = node.$;
  25. node.parentNode.insertBefore( this.$, node.nextSibling );
  26. }
  27. },
  28. true,
  29. {
  30. 'append' : 1,
  31. 'appendBogus' : 1,
  32. 'getFirst' : 1,
  33. 'getLast' : 1,
  34. 'appendTo' : 1,
  35. 'moveChildren' : 1,
  36. 'insertBefore' : 1,
  37. 'insertAfterNode' : 1,
  38. 'replace' : 1,
  39. 'trim' : 1,
  40. 'type' : 1,
  41. 'ltrim' : 1,
  42. 'rtrim' : 1,
  43. 'getDocument' : 1,
  44. 'getChildCount' : 1,
  45. 'getChild' : 1,
  46. 'getChildren' : 1
  47. } );