fix: wujie shadow root
fix:https://github.com/rrweb-io/rrweb/issues/1682
reproduce step: https://github.com/wfk007/rrweb-wujie
🦋 Changeset detected
Latest commit: 4ec827335e64891ce3e0a523bcb2e21864649472
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 19 packages
| Name | Type |
|---|---|
| rrweb | Patch |
| @rrweb/utils | Patch |
| rrweb-snapshot | Patch |
| rrdom | Patch |
| rrdom-nodejs | Patch |
| rrweb-player | Patch |
| @rrweb/all | Patch |
| @rrweb/replay | Patch |
| @rrweb/record | Patch |
| @rrweb/types | Patch |
| @rrweb/packer | Patch |
| @rrweb/web-extension | Patch |
| rrvideo | Patch |
| @rrweb/rrweb-plugin-console-record | Patch |
| @rrweb/rrweb-plugin-console-replay | Patch |
| @rrweb/rrweb-plugin-sequential-id-record | Patch |
| @rrweb/rrweb-plugin-sequential-id-replay | Patch |
| @rrweb/rrweb-plugin-canvas-webrtc-record | Patch |
| @rrweb/rrweb-plugin-canvas-webrtc-replay | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Wujie framework proxiesiframe.contentDocument.contains to the contains which this bind to shadow-root(document-fragment)
This explained the log output below:
const iframe = window.document.querySelector('IFRAME');
const head = iframe.contentDocument.querySelector('head');
// updated code simulate output
iframe.contentDocument.contains(head); // true
// Previous code simulate output
window.Node.prototype.contains.call(iframe.contentDocument, head); // false
iframe.contentWindow.Node.prototype.contains.bind(iframe.contentDocument)(head); // false
Is there anyone follow up this pr?
Looks like this is the correct fix: https://github.com/wfk007/rrweb-wujie/pull/1 wujie monkeypatches .ownerDocument and we where still accessing using the un-monkey accessor method which lead to the recording breaking
Looks like this is the correct fix: wfk007/rrweb-wujie#1 wujie monkeypatches .ownerDocument and we where still accessing using the un-monkey accessor method which lead to the recording breaking
This pr is working for me! 👍
Looks like this is the correct fix: wfk007/rrweb-wujie#1 wujie monkeypatches .ownerDocument and we where still accessing using the un-monkey accessor method which lead to the recording breaking
@Juice10 This is how I understand:
-
wujie: monkeypatches ownerDocument, making
shadowRootNode.ownerDocumentto iframe doc(created by wujie). https://github.com/Tencent/wujie/blob/ddfc5ccd730a2a87dfbfb455dbcac4618f5cee4b/packages/wujie-core/src/iframe.ts#L748 -
rrweb record: In
inDomfunction,ownerDocument(tainted by wijie) withcontains(unTainted with rrweb) give thefalsereturn, breaking the node serialized.
so, we need to keep ownerDocument and contains all unTainted.