Report an issue
Class

DocumentFragment (engine/view)

@ckeditor/ckeditor5-engine/src/view/documentfragment

class

DocumentFragment class.

Filtering

Properties

  • childCount : Number

    readonly

    Number of child nodes in this document fragment.

  • isEmpty : Boolean

    readonly

    Is true if there are no nodes inside this document fragment, false otherwise.

  • parent : null

    readonly

    Artificial parent of DocumentFragment. Returns null. Added for compatibility reasons.

  • root : DocumentFragment

    readonly

    Artificial root of DocumentFragment. Returns itself. Added for compatibility reasons.

  • _children : Array.<Element>

    protected

    Array of child nodes.

Methods

  • constructor( [ children ] )

    protected

    Creates new DocumentFragment instance.

    Parameters

    [ children ] : Node | Iterable.<Node>

    List of nodes to be inserted into created document fragment.

  • Symbol.iterator() → Iterable.<Node>

    Iterable interface.

    Iterates over nodes added to this document fragment.

    Returns

    Iterable.<Node>
  • _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.

    Parameters

    items : Item | Iterable.<Item>

    Items to be inserted.

    Returns

    Number

    Number of appended nodes.

  • _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.

    Parameters

    index : Number

    Position where nodes should be inserted.

    items : Item | Iterable.<Item>

    Items to be inserted.

    Returns

    Number

    Number of inserted nodes.

  • _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.

  • getChild( index ) → Node

    Gets child at the given index.

    Parameters

    index : Number

    Index of child.

    Returns

    Node

    Child node.

  • getChildIndex( node ) → Number

    Gets index of the given child node. Returns -1 if child node is not found.

    Parameters

    node : Node

    Child node.

    Returns

    Number

    Index of the child node.

  • getChildren() → Iterable.<Node>

    Gets child nodes iterator.

    Returns

    Iterable.<Node>

    Child nodes iterator.

  • is( type ) → Boolean

    Checks whether given view tree object is of given type.

    Read more in is.

    Parameters

    type : String

    Returns

    Boolean
  • _fireChange( type, node )

    private

    Fires change event with given type of the change.

    Parameters

    type : ChangeType

    Type of the change.

    node : Node

    Changed node.

    Fires