Skip to content

Commit

Permalink
enable rrweb handle special situations of LWC library
Browse files Browse the repository at this point in the history
  • Loading branch information
YunFeng0817 committed Nov 3, 2023
1 parent 1fe39ab commit 1d34471
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/rrweb-snapshot/src/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,15 @@ export function serializeNodeWithId(
stylesheetLoadTimeout,
keepIframeSrcFn,
};
for (const childN of Array.from(n.childNodes)) {
let childNodes = Array.from(n.childNodes) as Node[];
childNodes = childNodes.filter(
// filter out nodes that are assigned to a slot other places.
(childN) => !(childN as HTMLElement).assignedSlot,
);
if (n instanceof HTMLSlotElement)
// add nodes that are assigned to this slot and treat them as normal children.
childNodes = childNodes.concat(Array.from(n.assignedNodes()));
for (const childN of Array.from(childNodes)) {
const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
if (serializedChildNode) {
serializedNode.childNodes.push(serializedChildNode);
Expand Down

0 comments on commit 1d34471

Please sign in to comment.