* rrdom: add a diff function for properties * implement diffChildren function and unit tests * finish basic functions of diff algorithm * fix several bugs in the diff algorithm * replace the virtual parent optimization in applyMutation() * fix: moveAndHover after the diff algorithm is executed * replace virtual style map with rrdom cssom version has to be above 0.5.0 to pass virtual style tests * fix: failed virtual style tests in replayer.test.ts * fix: failed polyfill tests caused by nodejs compatibility of different versions * fix: svg viewBox attribute doesn't work Cause the attribute viewBox is case sensitive, set value for viewbox doesn't work * feat: replace treeIndex optimization with rrdom * fix bug of diffProps and disable smooth scrolling animation in fast-forward mode * feat: add iframe support * fix: @rollup/plugin-typescript build errors in rrweb-player Error: @rollup/plugin-typescript TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error' * fix: bug when fast-forward input events and add test for it * add test for fast-forward scroll events * fix: custom style rules don't get inserted into some iframe elements * code style tweak * fix: enable to diff iframe elements * fix the jest error "Unexpected token 'export'" * try to fix build error of rrweb-player * correct the attributes definition in rrdom * fix: custom style rules are not inserted in some iframes * add support for shadow dom * add support for MediaInteraction * add canvas support * fix unit test error in rrdom * add support for Text, Comment * try to refactor RRDom * refactor RRDom to reduce duplicate code * rename document-browser to virtual-dom * increase the test coverage for document.ts and add ownerDocument for it * Merge branch 'master' into virtual-dom * add more test for virtual-dom.ts * use cssstyle in document-nodejs * fix: bundle error * improve document-nodejs * enable to diff scroll positions of an element * rename rrdom to virtualDom for more readability and make the tree public * revert unknown change * improve the css style parser for comments * improve code style * update typings * add handling for the case where legacy_missingNodeRetryMap is not empty * only import types from rrweb into rrdom * Apply suggestions from code review Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com> * Apply suggestions from code review * fix building error in rrweb * add a method setDefaultSN to set a default value for a RRNode's __sn * fix rrweb test error and bump up other packages * add support for custom property of css styles * add a switch for virtual-dom optimization * Apply suggestions from code review 1. add an enum type for NodeType 2. rename nodeType from rrweb-snapshot to RRNodeType 3. rename notSerializedId to unserializedId 4. add comments for some confusing variables * adapt changes of #865 to virtual-dom and improve the test case for more coverage * apply review suggestions https://github.com/rrweb-io/rrweb/pull/853#pullrequestreview-922474953 * tweak the diff algorithm * add description of the flag useVirtualDom and remove outdated logConfig * Remove console.log * Contain changes to document * Upgrade rollup to 2.70.2 * Revert "Upgrade rollup to 2.70.2" This reverts commit b1be81a2a76565935c9dc391f31beb7f64d25956. * Fix type checking rrdom * Fix typing error while bundling * Fix tslib error on build Rollup would output the following error: `semantic error TS2343: This syntax requires an imported helper named '__spreadArray' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.` * Increase memory limit for rollup * Use esbuild for bundling Speeds up bundling significantly * Avoid circular dependencies and import un-bundled rrdom * Fix imports * Revert back to pre-esbuild This reverts the following commits: b7b3c8dbaa551a0129da1477136b1baaad28e6e1 72e23b8e27f9030d911358d3a17fe5ad1b3b5d4f 85d600a20c56cfa764cf1f858932ba14e67b1d23 61e1a5d323212ca8fbe0569e0b3062ddd53fc612 * Set node to lts (12 is no longer supported) * Speed up bundling and use less memory This fixes the out of memory errors happening while bundling * remove __sn from rrdom * fix typo * test: add a test case for StyleSheet mutation exceptions while fast-forwarding * rename Array.prototype.slice.call() to Array.from() * improve test cases * fix: PR #887 in 'virtual-dom' branch * apply justin's suggestion on 'Array.from' refactor related commit 0f6729d27a323260b36fbe79485a86715c0bc98a * improve import code structure Co-authored-by: Yun Feng <yun.feng@anu.edu.au>
161 lines
6.2 KiB
Plaintext
161 lines
6.2 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`RRDocument for browser environment create a RRDocument from a html document can build from a common html 1`] = `
|
|
"-1 RRDocument
|
|
-2 RRDocumentType
|
|
-3 HTML lang=\\"en\\"
|
|
-4 HEAD
|
|
-5 RRText text=\\"\\\\n \\"
|
|
-6 META charset=\\"UTF-8\\"
|
|
-7 RRText text=\\"\\\\n \\"
|
|
-8 META name=\\"viewport\\" content=\\"width=device-width, initial-scale=1.0\\"
|
|
-9 RRText text=\\"\\\\n \\"
|
|
-10 TITLE
|
|
-11 RRText text=\\"Main\\"
|
|
-12 RRText text=\\"\\\\n \\"
|
|
-13 LINK rel=\\"stylesheet\\" href=\\"somelink\\"
|
|
-14 RRText text=\\"\\\\n \\"
|
|
-15 STYLE
|
|
-16 RRText text=\\"\\\\n h1 {\\\\n color: 'black';\\\\n }\\\\n .blocks {\\\\n padding: 0;\\\\n }\\\\n .blocks1 {\\\\n margin: 0;\\\\n }\\\\n #block1 {\\\\n width: 100px;\\\\n height: 200px;\\\\n }\\\\n @import url('main.css');\\\\n \\"
|
|
-17 RRText text=\\"\\\\n \\"
|
|
-18 RRText text=\\"\\\\n \\"
|
|
-19 BODY
|
|
-20 RRText text=\\"\\\\n \\"
|
|
-21 H1
|
|
-22 RRText text=\\"This is a h1 heading\\"
|
|
-23 RRText text=\\"\\\\n \\"
|
|
-24 H1 style=\\"font-size: 16px\\"
|
|
-25 RRText text=\\"This is a h1 heading with styles\\"
|
|
-26 RRText text=\\"\\\\n \\"
|
|
-27 DIV id=\\"block1\\" class=\\"blocks blocks1\\"
|
|
-28 RRText text=\\"\\\\n \\"
|
|
-29 DIV id=\\"block2\\" class=\\"blocks blocks1 :hover\\"
|
|
-30 RRText text=\\"\\\\n Text 1\\\\n \\"
|
|
-31 DIV id=\\"block3\\"
|
|
-32 RRText text=\\"\\\\n \\"
|
|
-33 P
|
|
-34 RRText text=\\"This is a paragraph\\"
|
|
-35 RRText text=\\"\\\\n \\"
|
|
-36 BUTTON
|
|
-37 RRText text=\\"button1\\"
|
|
-38 RRText text=\\"\\\\n \\"
|
|
-39 RRText text=\\"\\\\n Text 2\\\\n \\"
|
|
-40 RRText text=\\"\\\\n \\"
|
|
-41 IMG src=\\"somelink\\" alt=\\"This is an image\\"
|
|
-42 RRText text=\\"\\\\n \\"
|
|
-43 RRComment text=\\" This is a line of comment \\"
|
|
-44 RRText text=\\"\\\\n \\"
|
|
-45 FORM
|
|
-46 RRText text=\\"\\\\n \\"
|
|
-47 INPUT type=\\"text\\" id=\\"input1\\"
|
|
-48 RRText text=\\"\\\\n \\"
|
|
-49 RRText text=\\"\\\\n \\"
|
|
-50 RRText text=\\"\\\\n \\\\n\\\\n\\"
|
|
"
|
|
`;
|
|
|
|
exports[`RRDocument for browser environment create a RRDocument from a html document can build from a html containing nested shadow doms 1`] = `
|
|
"-1 RRDocument
|
|
-2 RRDocumentType
|
|
-3 HTML lang=\\"en\\"
|
|
-4 HEAD
|
|
-5 RRText text=\\"\\\\n \\"
|
|
-6 META charset=\\"UTF-8\\"
|
|
-7 RRText text=\\"\\\\n \\"
|
|
-8 META name=\\"viewport\\" content=\\"width=device-width, initial-scale=1.0\\"
|
|
-9 RRText text=\\"\\\\n \\"
|
|
-10 TITLE
|
|
-11 RRText text=\\"shadow dom\\"
|
|
-12 RRText text=\\"\\\\n \\"
|
|
-13 RRText text=\\"\\\\n \\"
|
|
-14 BODY
|
|
-15 RRText text=\\"\\\\n \\"
|
|
-16 DIV
|
|
-17 SHADOWROOT
|
|
-18 RRText text=\\"\\\\n \\"
|
|
-19 SPAN
|
|
-20 RRText text=\\" shadow dom one \\"
|
|
-21 RRText text=\\"\\\\n \\"
|
|
-22 DIV
|
|
-23 SHADOWROOT
|
|
-24 RRText text=\\"\\\\n \\"
|
|
-25 SPAN
|
|
-26 RRText text=\\" shadow dom two \\"
|
|
-27 RRText text=\\"\\\\n \\"
|
|
-28 RRText text=\\"\\\\n \\\\n \\"
|
|
-29 RRText text=\\"\\\\n \\"
|
|
-30 RRText text=\\"\\\\n \\\\n \\"
|
|
-31 RRText text=\\"\\\\n \\\\n\\\\n\\"
|
|
"
|
|
`;
|
|
|
|
exports[`RRDocument for browser environment create a RRDocument from a html document can build from a xml page 1`] = `
|
|
"-1 RRDocument
|
|
-2 XML
|
|
-3 RRCDATASection data=\\"Some <CDATA> data & then some\\"
|
|
"
|
|
`;
|
|
|
|
exports[`RRDocument for browser environment create a RRDocument from a html document can build from an iframe html 1`] = `
|
|
"-1 RRDocument
|
|
-2 RRDocumentType
|
|
-3 HTML lang=\\"en\\"
|
|
-4 HEAD
|
|
-5 RRText text=\\"\\\\n \\"
|
|
-6 META charset=\\"UTF-8\\"
|
|
-7 RRText text=\\"\\\\n \\"
|
|
-8 META name=\\"viewport\\" content=\\"width=device-width, initial-scale=1.0\\"
|
|
-9 RRText text=\\"\\\\n \\"
|
|
-10 TITLE
|
|
-11 RRText text=\\"Iframe\\"
|
|
-12 RRText text=\\"\\\\n \\"
|
|
-13 RRText text=\\"\\\\n \\"
|
|
-14 BODY
|
|
-15 RRText text=\\"\\\\n \\"
|
|
-16 IFRAME id=\\"iframe1\\" srcdoc=\\"
|
|
<html>
|
|
<head>
|
|
<meta charset='UTF-8' />
|
|
<meta
|
|
name='viewport'
|
|
content='width=device-width, initial-scale=1.0'
|
|
/>
|
|
</head>
|
|
<body>
|
|
<div>This is a block inside the iframe1.</div>
|
|
<iframe id='iframe3' srcdoc='<div>This is a block inside the iframe3.</div>'>
|
|
</body>
|
|
</html>\\"
|
|
-17 RRDocument
|
|
-18 HTML
|
|
-19 HEAD
|
|
-20 RRText text=\\"\\\\n \\"
|
|
-21 META charset=\\"UTF-8\\"
|
|
-22 RRText text=\\"\\\\n \\"
|
|
-23 META name=\\"viewport\\" content=\\"width=device-width, initial-scale=1.0\\"
|
|
-24 RRText text=\\"\\\\n \\"
|
|
-25 RRText text=\\"\\\\n \\"
|
|
-26 BODY
|
|
-27 RRText text=\\"\\\\n \\"
|
|
-28 DIV
|
|
-29 RRText text=\\"This is a block inside the iframe1.\\"
|
|
-30 RRText text=\\"\\\\n \\"
|
|
-31 IFRAME id=\\"iframe3\\" srcdoc=\\"<div>This is a block inside the iframe3.</div>\\"
|
|
-32 RRDocument
|
|
-33 HTML
|
|
-34 HEAD
|
|
-35 BODY
|
|
-36 DIV
|
|
-37 RRText text=\\"This is a block inside the iframe3.\\"
|
|
-38 RRText text=\\"\\\\n \\"
|
|
-39 IFRAME id=\\"iframe2\\" srcdoc=\\"<div>This is a block inside the iframe2.</div>\\"
|
|
-40 RRDocument
|
|
-41 HTML
|
|
-42 HEAD
|
|
-43 BODY
|
|
-44 DIV
|
|
-45 RRText text=\\"This is a block inside the iframe2.\\"
|
|
-46 RRText text=\\"\\\\n \\\\n\\\\n\\"
|
|
"
|
|
`;
|