Feat: Add support for replaying :defined pseudo-class of custom elements (#1155)
* Feat: Add support for replaying :defined pseudo-class of custom elements * add isCustom flag to serialized elements Applying Justin's review suggestion * fix code lint error * add custom element event * fix: tests (#1348) * Update packages/rrweb/src/record/observer.ts * Update packages/rrweb/src/record/observer.ts --------- Co-authored-by: Nafees Nehar <nafees87n@gmail.com> Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
This commit is contained in:
@@ -801,6 +801,13 @@ function serializeElementNode(
|
||||
delete attributes.src; // prevent auto loading
|
||||
}
|
||||
|
||||
let isCustomElement: true | undefined;
|
||||
try {
|
||||
if (customElements.get(tagName)) isCustomElement = true;
|
||||
} catch (e) {
|
||||
// In case old browsers don't support customElements
|
||||
}
|
||||
|
||||
return {
|
||||
type: NodeType.Element,
|
||||
tagName,
|
||||
@@ -809,6 +816,7 @@ function serializeElementNode(
|
||||
isSVG: isSVGElement(n as Element) || undefined,
|
||||
needBlock,
|
||||
rootId,
|
||||
isCustom: isCustomElement,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user