Description
Preflight Checklist
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
What package is this bug report for?
rrweb
Version
latest version with #1272 applied
Expected Behavior
inline styles recorded correctly
Actual Behavior
inline styles recorded as follows:
<style type="text/css">
[object CSSStyleRule][object CSSStyleRule][object CSSStyleRule][object CSSStyleRule][object CSSStyleRule][object CSSStyleRule][object CSSStyleRule][object CSSStyleRule][object CSSStyleRule ...
</style>
Steps to Reproduce
#1272 makes full use of the second map argument of the built in Array.from
I discovered today that MooTools < 1.6 implements their own version of Array.from, which lacks the second argument, so if an old version of mootools is on a website it messes things up — or also an old version of Prototype (e.g. 1.7.1)
I did a similar 'guard' for Date.now being overwritten in #1196
Is it a good idea to do the same in this case?
There might be small performance loss from an extra function, but main question would be whether it is our responsibility to patch over this sort of thing?
Here is a test to undo changes from 3rd party libraries:
if (Array.from([1], (x)=>x*2)[0] !== 2) {
// https://stackoverflow.com/a/8580576/6691
const dummy_iframe = document.createElement("iframe");
document.documentElement.appendChild(dummy_iframe);
Array.from = dummy_iframe.contentWindow.Array.from; // a clean working version
//Array.prototype.from = dummy_iframe.contentWindow.Array.prototype.from; // this is given in SO answer but doesn't work for some reason
document.documentElement.removeChild(dummy_iframe);
}
Testcase Gist URL
No response
Additional Information
No response