DocumentFragment (engine/view)
@ckeditor/ckeditor5-engine/src/view/documentfragment
Document fragment.
To create a new document fragment instance use the
UpcastWriter#createDocumentFragment()
method.
Filtering
Properties
-
childCount : Number
module:engine/view/documentfragment~DocumentFragment#childCount
readonly
Number of child nodes in this document fragment.
-
The document to which this document fragment belongs.
-
isEmpty : Boolean
module:engine/view/documentfragment~DocumentFragment#isEmpty
readonly
Is
true
if there are no nodes inside this document fragment,false
otherwise. -
parent : null
module:engine/view/documentfragment~DocumentFragment#parent
readonly
Artificial parent of
DocumentFragment
. Returnsnull
. Added for compatibility reasons. -
root : DocumentFragment
module:engine/view/documentfragment~DocumentFragment#root
readonly
Artificial root of
DocumentFragment
. Returns itself. Added for compatibility reasons. -
Array of child nodes.
Methods
-
constructor( document, [ children ] )
module:engine/view/documentfragment~DocumentFragment#constructor
protected
Creates new DocumentFragment instance.
-
Symbol.iterator() → Iterable.<Node>
module:engine/view/documentfragment~DocumentFragment#Symbol.iterator
Iterable interface.
-
_appendChild( items ) → Number
module:engine/view/documentfragment~DocumentFragment#_appendChild
Insert a child node or a list of child nodes at the end and sets the parent of these nodes to this fragment.
-
_insertChild( index, items ) → Number
module:engine/view/documentfragment~DocumentFragment#_insertChild
Inserts a child node or a list of child nodes on the given index and sets the parent of these nodes to this fragment.
-
_removeChildren( index, [ howMany ] ) → Array.<Node>
module:engine/view/documentfragment~DocumentFragment#_removeChildren
Removes number of child nodes starting at the given index and set the parent of these nodes to
null
.Parameters
index : Number
Number of the first node to remove.
[ howMany ] : Number
Number of nodes to remove.
Defaults to
1
Returns
Array.<Node>
The array of removed nodes.
-
Gets child at the given index.
-
getChildIndex( node ) → Number
module:engine/view/documentfragment~DocumentFragment#getChildIndex
Gets index of the given child node. Returns
-1
if child node is not found. -
getChildren() → Iterable.<Node>
module:engine/view/documentfragment~DocumentFragment#getChildren
Gets child nodes iterator.
Returns
Iterable.<Node>
Child nodes iterator.
-
is( type ) → Boolean
module:engine/view/documentfragment~DocumentFragment#is
Checks whether this object is of the given type.
docFrag.is( 'documentFragment' ); // -> true docFrag.is( 'view:documentFragment' ); // -> true docFrag.is( 'model:documentFragment' ); // -> false docFrag.is( 'element' ); // -> false docFrag.is( 'node' ); // -> false
Check the entire list of view objects which implement the
is()
method.Parameters
type : String
Returns
Boolean
-
_fireChange( type, node )
module:engine/view/documentfragment~DocumentFragment#_fireChange
private
Fires
change
event with given type of the change.
Every day, we work hard to keep our documentation complete. Have you spotted an outdated information? Is something missing? Please report it via our issue tracker.