safely scroll element since its last event may fired after being removed
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { rebuild, buildNodeWithSN } from 'rrweb-snapshot';
|
import { rebuild, buildNodeWithSN, INode } from 'rrweb-snapshot';
|
||||||
import * as mittProxy from 'mitt';
|
import * as mittProxy from 'mitt';
|
||||||
import Timer from './timer';
|
import Timer from './timer';
|
||||||
import {
|
import {
|
||||||
@@ -422,8 +422,15 @@ export class Replayer {
|
|||||||
behavior: isSync ? 'instant' : 'smooth',
|
behavior: isSync ? 'instant' : 'smooth',
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
(target as Element).scrollTop = d.y;
|
try {
|
||||||
(target as Element).scrollLeft = d.x;
|
(target as Element).scrollTop = d.y;
|
||||||
|
(target as Element).scrollLeft = d.x;
|
||||||
|
} catch (error) {
|
||||||
|
/**
|
||||||
|
* Seldomly we may found scroll target was removed before
|
||||||
|
* its last scroll event.
|
||||||
|
*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user