Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve: some websites rebuild imcomplete #1163

Merged
merged 3 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/rrweb/src/record/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export default class MutationBuffer {
this.mirror.removeNodeFromMap(this.mapRemoves.shift()!);
}

for (const n of Array.from(this.movedSet.values())) {
for (const n of this.movedSet) {
YunFeng0817 marked this conversation as resolved.
Show resolved Hide resolved
if (
isParentRemoved(this.removes, n, this.mirror) &&
!this.movedSet.has(n.parentNode!)
Expand All @@ -342,7 +342,7 @@ export default class MutationBuffer {
pushAdd(n);
}

for (const n of Array.from(this.addedSet.values())) {
for (const n of this.addedSet) {
if (
!isAncestorInSet(this.droppedSet, n) &&
!isParentRemoved(this.removes, n, this.mirror)
Expand Down
14 changes: 9 additions & 5 deletions packages/rrweb/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,15 @@ export function isBlocked(
: node.parentElement;
if (!el) return false;

if (typeof blockClass === 'string') {
if (el.classList.contains(blockClass)) return true;
if (checkAncestors && el.closest('.' + blockClass) !== null) return true;
} else {
if (classMatchesRegex(el, blockClass, checkAncestors)) return true;
try {
YunFeng0817 marked this conversation as resolved.
Show resolved Hide resolved
if (typeof blockClass === 'string') {
if (el.classList.contains(blockClass)) return true;
if (checkAncestors && el.closest('.' + blockClass) !== null) return true;
} else {
if (classMatchesRegex(el, blockClass, checkAncestors)) return true;
}
} catch (e) {
// e
}
if (blockSelector) {
if (el.matches(blockSelector)) return true;
Expand Down