improve rrdom performance (#1127)
* add more check to rrdom to make diff algorithm more robust * fix: selector match in iframe is case-insensitive add try catch to some fragile points * test: increase timeout value for Jest * improve code style * fix: failed to execute insertBefore on Node in the diff function this happens when ids of doctype or html element are changed in the virtual dom also improve the code quality * refactor diff function to make the code cleaner * fix: virtual nodes are passed to plugin's onBuild function * refactor the diff function and adjust the order of diff work. * call afterAppend hook in a consistent traversal order * improve the performance of the "contains" function reduce the complexity from O(n) to O(logn) a specific benchmark is needed to add further * add a real events for benchmark * refactor: change the data structure of childNodes from array to linked list * remove legacy code in rrweb package * update unit tests * update change log
This commit is contained in:
@@ -1271,7 +1271,7 @@ describe('diff algorithm for rrdom', () => {
|
||||
expect(rrdom.mirror.getId(rrdom)).toBe(-2);
|
||||
expect(rrdom.mirror.getId(rrdom.body)).toBe(-6);
|
||||
|
||||
rrdom.childNodes = [];
|
||||
while (rrdom.firstChild) rrdom.removeChild(rrdom.firstChild);
|
||||
/**
|
||||
* Rebuild the rrdom and make it looks like this:
|
||||
* -7 RRDocument
|
||||
|
||||
Reference in New Issue
Block a user