Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
scofalik committed Sep 28, 2017
1 parent 1cd7a8c commit 669ff4f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/view/observer/mutationobserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export default class MutationObserver extends Observer {
for ( const viewElement of mutatedElements ) {
const domElement = domConverter.mapViewToDom( viewElement );
const viewChildren = Array.from( viewElement.getChildren() );
const newViewChildren = Array.from( domConverter.domChildrenToView( domElement ) );
const newViewChildren = Array.from( domConverter.domChildrenToView( domElement, { withChildren: false } ) );

// It may happen that as a result of many changes (sth was inserted and then removed),
// both elements haven't really changed. #1031
Expand Down
24 changes: 20 additions & 4 deletions src/view/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,16 @@ export default class Renderer {
this.markedChildren.add( inlineFillerPosition.parent );
}

for ( const element of this.markedChildren ) {
this._updateChildren( element, { inlineFillerPosition } );

for ( const child of element.getChildren() ) {
if ( child.is( 'element' ) ) {
this._addTextDescendantsToUpdate( child );
}
}
}

for ( const node of this.markedTexts ) {
if ( !this.markedChildren.has( node.parent ) && this.domConverter.mapViewToDom( node.parent ) ) {
this._updateText( node, { inlineFillerPosition } );
Expand All @@ -207,10 +217,6 @@ export default class Renderer {
this._updateAttrs( element );
}

for ( const element of this.markedChildren ) {
this._updateChildren( element, { inlineFillerPosition } );
}

// Check whether the inline filler is required and where it really is in the DOM.
// At this point in most cases it will be in the DOM, but there are exceptions.
// For example, if the inline filler was deep in the created DOM structure, it will not be created.
Expand Down Expand Up @@ -241,6 +247,16 @@ export default class Renderer {
this.markedChildren.clear();
}

_addTextDescendantsToUpdate( element ) {
for ( const child of element.getChildren() ) {
if ( child.is( 'text' ) ) {
this.markedTexts.add( child );
} else {
this._addTextDescendantsToUpdate( child );
}
}
}

/**
* Adds inline filler at given position.
*
Expand Down

0 comments on commit 669ff4f

Please sign in to comment.