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

Commit

Permalink
Revert "Remove fake selection container before inspecting changed chi…
Browse files Browse the repository at this point in the history
…ld nodes in Renderer.render()."

This reverts commit 24c44a7
  • Loading branch information
jodator committed Feb 25, 2019
1 parent 24c44a7 commit 2f2b42e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 29 deletions.
6 changes: 2 additions & 4 deletions src/view/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@ export default class Renderer {
render() {
let inlineFillerPosition;

// Remove unneeded fake selection container from the DOM so it will not affect the DOM nodes diffing.
// It will be re-added if needed when rendering the selection.
this._removeFakeSelection();

// Refresh mappings.
for ( const element of this.markedChildren ) {
this._updateChildrenMappings( element );
Expand Down Expand Up @@ -664,6 +660,7 @@ export default class Renderer {
// If there is no selection - remove DOM and fake selections.
if ( this.selection.rangeCount === 0 ) {
this._removeDomSelection();
this._removeFakeSelection();

return;
}
Expand All @@ -679,6 +676,7 @@ export default class Renderer {
if ( this.selection.isFake ) {
this._updateFakeSelection( domRoot );
} else {
this._removeFakeSelection();
this._updateDomSelection( domRoot );
}
}
Expand Down
25 changes: 0 additions & 25 deletions tests/view/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3320,31 +3320,6 @@ describe( 'Renderer', () => {
return viewData.repeat( repeat );
}
} );

it( 'should work with fake selection container', () => {
let viewString = '';

for ( let i = 0; i < 151; i++ ) {
viewString += '<container:p>foo</container:p>';
}

viewRoot._appendChild( parse( viewString ) );

// Set fake selection
selection._setTo( viewRoot.getChild( 1 ), 'on', { fake: true } );

renderer.markToSync( 'children', viewRoot );
renderer.render();

viewRoot._removeChildren( 1, 1 );
selection._setTo( viewRoot.getChild( 0 ), 'in' );

renderer.markToSync( 'children', viewRoot );

expect( () => {
renderer.render();
} ).to.not.throw();
} );
} );

describe( '#922', () => {
Expand Down

0 comments on commit 2f2b42e

Please sign in to comment.