Skip to content

Commit

Permalink
Merge pull request #17518 from ckeditor/ck/17490-docs
Browse files Browse the repository at this point in the history
Docs: Updated API docs and inline comments.
  • Loading branch information
scofalik authored Nov 21, 2024
2 parents cce3ce9 + 380b164 commit 9db0079
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/ckeditor5-engine/src/conversion/upcastdispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,8 @@ export default class UpcastDispatcher extends /* #__PURE__ */ EmitterMixin() {
* as some elements might have become empty after other empty elements were removed from them.
*/
private _removeEmptyElements(): void {
// For every parent, prepare an array of children (empty elements) to remove from it.
// Then, in next step, we will remove all children together, which is faster than removing them one by one.
const toRemove = new Map<ModelElement | ModelDocumentFragment, Array<ModelElement>>();

for ( const element of this._splitParts.keys() ) {
Expand Down
4 changes: 4 additions & 0 deletions packages/ckeditor5-engine/src/model/documentfragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ export default class DocumentFragment extends TypeCheckable implements Iterable<
* Removes children nodes provided as an array and sets
* the {@link module:engine/model/node~Node#parent parent} of these nodes to `null`.
*
* These nodes do not need to be direct siblings.
*
* This method is faster than removing nodes one by one, as it recalculates offsets only once.
*
* @internal
* @param nodes Array of nodes.
*/
Expand Down
4 changes: 4 additions & 0 deletions packages/ckeditor5-engine/src/model/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ export default class Element extends Node {
* Removes children nodes provided as an array and sets
* the {@link module:engine/model/node~Node#parent parent} of these nodes to `null`.
*
* These nodes do not need to be direct siblings.
*
* This method is faster than removing nodes one by one, as it recalculates offsets only once.
*
* @internal
* @param nodes Array of nodes.
*/
Expand Down
4 changes: 3 additions & 1 deletion packages/ckeditor5-engine/src/model/nodelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ export default class NodeList implements Iterable<Node> {
}

/**
* Removes children nodes provided as an array.
* Removes children nodes provided as an array. These nodes do not need to be direct siblings.
*
* This method is faster than removing nodes one by one, as it recalculates offsets only once.
*
* @internal
* @param nodes Array of nodes.
Expand Down

0 comments on commit 9db0079

Please sign in to comment.