* Extract method (isElementBlocked) and add tests
* Add blockSelector argument to snapshot
If blockSelector is passed, it will be matched against the element.
Reasoning: Mutating class names can get messy, so providing another hook
helps keep code clean by using data-attributes instead.
* Preserve original quotes when rewriting CSS url() paths - important for inline SVG files which often have spaces
* Found an example in the wild with the 'charset=' part left off. This is supported by https://css-tricks.com/lodge/svg/09-svg-data-uris/ ... not sure why we aren't just testing for the 'data:' prefix here?
* Not sure why this is now coming back with a double quote after recent changes here; it's supposed to preserve the single quote from style.css??
* Add a `slimDOM` option to strip out unnecessary parts of the DOM in terms of replay
- <script> tags in the <head> take up unnecessary storage space and are often injected semi randomly to become a source of unnecessary variation between recordings of the same thing
- comment tags can be stripped out without affecting display
- future: this option could also turn on more aggressive stripping, e.g. elements that are hidden by CSS (assuming we can handle them becoming visible after mutation events)
* Mark nodes ignored due to slimDOM option, so that they can also be ignored by the mutation observer in rrweb
* Introducing the `ignored` attribute violates the `serializedNodeWithId` type
* slimDOM: Strip out whitespace nodes from <head> element as they have no effect but take up space
- these would otherwise have to be merged after <script> elements are removed; for statcounter usecase, removing
<script> elements is no good if there is still a trace of their presence due to the white space (and hence a variant <head> node is still produced)
- I explored a more radical stripping of all white space nodes, but there is a problem if parent node is <pre> or otherwise rendered with `white-space: pre` and similar.
detecting applied styles with getComputedStyle would be very expensive (I haven't measured it though)
* Export IGNORED_NODE as a constant instead of relying on the hard-to-grok `-2`
* Remove <link rel=preload as=script> which are similarly as useless as <script> tags
* Make slimDOM configurable with the expecations that `slimDOMOptions: true` will only enable non-destructive options (so not all options may be turned on)
* Expand slimDOM to add options to remove more elements from the <head> that should not be necessary in the replayer context
1. Do not use virtual parent optimization if the mutation targets have iframe elements as children. This will cause some performance regression but will be easy to add and ship.
2. If an iframe element has already been a child of a virtual parent, add the virtual parent back to the dom.
* feat: add options to mask texts
* feat: add the default mask function
* refactor: rename options to identify the difference between mask text and mask input
* test: add tests about masking
* doc: add options about masking
* chore: bump up rrweb-snapshot version
* Sort events at start, as otherwise we risk misidentifying the last event
* Keep inserted events in the correct order, ensuring we don't misidentify the last event
- e.g. network conditions mean that 'live' events come in non-sequentially
- or so that adding custom events to an existing event works
* Ensure we maintain original ordering while inserting a new event which has an identical timestamp to an existing event. This came up with a series of mutations which had the same timestamp but needed to be applied in the correct order
* Fast track the common case of a new event being added which occurs after all prior events
- was making this change for <wix-image> on Wix websites, but discovered after that this has already been done in e4593ff76d
- have tested document.createElement('wix-image') and document.createElement('foo_bar'), but can't find a canonical source for what is allowed in tag names.
- this restriction was originally introduced in #150 to prevent document.createElement('alt=""') i.e. a very malformed tag name