]>
git.immae.eu Git - perso/Immae/Projets/packagist/piedsjaloux-ckeditor-component.git/blob - sources/core/dom/documentfragment.js
10581444d5494e4e57614539d9317330e5871d36
2 * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
7 * 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 document fragment objects
10 * as arguments and result in all the child nodes of the document fragment being
11 * moved to the child list of this node.
14 * @constructor Creates a document fragment class instance.
15 * @param {CKEDITOR.dom.document/DocumentFragment} [nodeOrDoc=CKEDITOR.document]
17 CKEDITOR
.dom
.documentFragment = function( nodeOrDoc
) {
18 nodeOrDoc
= nodeOrDoc
|| CKEDITOR
.document
;
20 if ( nodeOrDoc
.type
== CKEDITOR
.NODE_DOCUMENT
)
21 this.$ = nodeOrDoc
.$.createDocumentFragment();
26 CKEDITOR
.tools
.extend( CKEDITOR
.dom
.documentFragment
.prototype, CKEDITOR
.dom
.element
.prototype, {
28 * The node type. This is a constant value set to {@link CKEDITOR#NODE_DOCUMENT_FRAGMENT}.
31 * @property {Number} [=CKEDITOR.NODE_DOCUMENT_FRAGMENT]
33 type: CKEDITOR
.NODE_DOCUMENT_FRAGMENT
,
36 * Inserts the document fragment content after the specified node.
38 * @param {CKEDITOR.dom.node} node
40 insertAfterNode: function( node
) {
42 node
.parentNode
.insertBefore( this.$, node
.nextSibling
);
46 * Gets HTML of this document fragment's children.
49 * @returns {String} The HTML of this document fragment's children.
52 var container
= new CKEDITOR
.dom
.element( 'div' );
54 this.clone( 1, 1 ).appendTo( container
);
56 return container
.getHtml().replace( /\s*data-cke-expando=".*?"/g, '' );
59 'append': 1, 'appendBogus': 1, 'clone': 1, 'getFirst': 1, 'getHtml': 1, 'getLast': 1, 'getParent': 1, 'getNext': 1, 'getPrevious': 1,
60 'appendTo': 1, 'moveChildren': 1, 'insertBefore': 1, 'insertAfterNode': 1, 'replace': 1, 'trim': 1, 'type': 1,
61 'ltrim': 1, 'rtrim': 1, 'getDocument': 1, 'getChildCount': 1, 'getChild': 1, 'getChildren': 1