Fix: shadow dom bugs (#1049)
* Add test cases for bugs * Fix shadow dom recording When moving an element containing shadow dom When adding an element to shadow dom before its attached to the dom * Apply formatting changes * Refactor in dom checking code * Nodes don't get processed in more than one mutation buffer * Constrain node mutations to one mutation buffer per request animation frame * Make tests less flaky under heavy load * Apply suggestions from code review * Update packages/rrweb-snapshot/test/rebuild.test.ts * Remove unused nodeSet Co-authored-by: Yun Feng <yun.feng0817@gmail.com>
This commit is contained in:
@@ -47,6 +47,37 @@ describe('rebuild', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('shadowDom', function () {
|
||||
it('rebuild shadowRoot without siblings', function () {
|
||||
const node = buildNodeWithSN(
|
||||
{
|
||||
id: 1,
|
||||
tagName: 'div',
|
||||
type: NodeType.Element,
|
||||
attributes: {},
|
||||
childNodes: [
|
||||
{
|
||||
id: 2,
|
||||
tagName: 'div',
|
||||
type: NodeType.Element,
|
||||
attributes: {},
|
||||
childNodes: [],
|
||||
isShadow: true,
|
||||
},
|
||||
],
|
||||
isShadowHost: true,
|
||||
},
|
||||
{
|
||||
doc: document,
|
||||
mirror,
|
||||
hackCss: false,
|
||||
cache,
|
||||
},
|
||||
) as HTMLDivElement;
|
||||
expect(node.shadowRoot?.childNodes.length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('add hover class to hover selector related rules', function () {
|
||||
it('will do nothing to css text without :hover', () => {
|
||||
const cssText = 'body { color: white }';
|
||||
|
||||
Reference in New Issue
Block a user