Skip to content

Commit a9da7a5

Browse files
committed
Merge branch 't/9239c'
2 parents f4a14de + 9022ebd commit a9da7a5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/selection.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,12 @@
12971297
this.reset();
12981298

12991299
if ( restore ) {
1300+
// Saved selection may be outdated (e.g. anchored in offline nodes).
1301+
// Avoid getting broken by such.
1302+
var common = selectedElement || ranges[ 0 ].getCommonAncestor();
1303+
if ( !( common && common.getAscendant( 'body', 1 ) ) )
1304+
return;
1305+
13001306
if ( selectedElement )
13011307
this.selectElement( selectedElement );
13021308
else

0 commit comments

Comments
 (0)