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
readonly
Number of child nodes in this document fragment.
-
The document to which this document fragment belongs.
-
isEmpty : Boolean
readonly
Is
true
if there are no nodes inside this document fragment,false
otherwise. -
parent : null
readonly
Artificial parent of
DocumentFragment
. Returnsnull
. Added for compatibility reasons. -
root : DocumentFragment
readonly
Artificial root of
DocumentFragment
. Returns itself. Added for compatibility reasons. -
Array of child nodes.
Methods
-
constructor( document, [ children ] )
protected
Creates new DocumentFragment instance.
-
Symbol.iterator() → Iterable.<Node>
Iterable interface.
-
_appendChild( items ) → Number
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
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>
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
Gets index of the given child node. Returns
-1
if child node is not found. -
getChildren() → Iterable.<Node>
Gets child nodes iterator.
Returns
Iterable.<Node>
Child nodes iterator.
-
is( type ) → Boolean
Checks whether this object is of the given type.
Check the entire list of view objects which implement the
is()
method.Parameters
type : String
Returns
Boolean
-
_fireChange( type, node )
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.