Commit Graph

117 Commits

Author SHA1 Message Date
AssafKr
10eead6d42 Handle quoted strings in data url (#84)
* handle quoted strings in data url

* unrefactor

* update package json

* Revert "update package json"

This reverts commit 9446109b0f94d9e569a961642f1e57b1a67793ee.

* change background-image to border-image
2021-07-11 16:47:58 +08:00
Justin Halsall
775291042d move maskInputValue to rrweb-snapshot (#83)
More info: https://github.com/rrweb-io/rrweb/pull/602#discussion_r660434998
2021-06-30 22:41:37 +08:00
Yanzhen Yu
778b22dc81 format code 2021-06-29 18:37:49 +08:00
bachmanity1
b1a8b6926a add keepIframeSrcFn option (#81)
* add allowIframe option to snapshot

* rename allowIframe to keepIframeSrcFn
2021-06-29 18:07:47 +08:00
Yun Feng
2cf4ddd9e2 style(rebuild.ts snapshot.ts): format code 2021-06-23 16:58:38 +08:00
bachmanity1
f5509d3a47 fix media playback bug (#80) 2021-06-23 16:54:01 +08:00
Lucky Feng
079ecd4972 fix: "Uncaught TypeError: Cannot read property 'insertRule' of null" caused by CSP style-src (#79) 2021-06-09 18:55:03 +08:00
Justin Halsall
6710e2c0e3 Fixes https://github.com/rrweb-io/rrweb/issues/567 (#78) 2021-06-06 21:52:51 +08:00
mgoshorn
9fbd7e1661 Updates regex used to validate tagnames to allow for tagnames that include namespace information (esp: svg tags) (#77)
Co-authored-by: Mitch Goshorn <mitch.goshorn@calmid.com>
2021-05-27 19:17:09 +08:00
Yanzhen Yu
0d1dbdd0a7 related to #75 mask password input by default 2021-05-13 02:18:54 +08:00
Justin Halsall
0bb95f1ee7 Allow password to be maskable instead of ignorable (#65)
* Add password to maskInputOptions on types

* Add password on maskInputOptions to types definition
2021-05-13 02:13:44 +08:00
Eoghan Murray
362359eccc Improve parsing of srcset according to whatwg spec (#74)
* Improve parsing of srcset according to whatwg spec; e.g. srcset="http://example.com/size400,300/img.jpg 640w"

* Trim/normalise the output in order to conform to prior version; solely to keep tests happy

* Add test case for embedded commas in a srcset url as well as support for future possible parenthesis in descriptor string

* Drop 'future proof' test as it causes an error message in test output
2021-05-04 13:28:38 +08:00
re-fort
a0d82589b7 Enable to mask texts (#73)
* chore: reorder options

* feat: enable 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
2021-04-22 15:34:36 +08:00
Justin Halsall
3c2d7c1eea Speed up addHoverClass on large stylesheets (#72)
* speed up addHoverClass on large style sheets

* longer strings first to prevent accidental partial matches

* can add hover class when there is a multi selector with the same prefix

* tweak performance
2021-04-22 15:32:50 +08:00
Yanzhen Yu
9d6696befd add isShadow flag if a node is under shadow root 2021-03-28 17:49:41 +08:00
Yanzhen Yu
88f348a57b snapshot and rebuild shadow DOM
https://github.com/rrweb-io/rrweb/issues/38
2021-03-13 20:46:18 +08:00
Yanzhen Yu
cf5c34592e add typings script to prepack 2021-02-27 18:00:56 +08:00
Eoghan Murray
4bf3073d80 Found an example in the wild of the deprecated pre-css way of adding a background image to table cells (#69) 2021-02-27 17:59:42 +08:00
Yanzhen Yu
8307c87ced using for loop instead of forEach in element classlists
pick #64 and close #68
2021-02-25 21:15:14 +08:00
Province Innovation
dbdf58a29d Valid tag names can include any digit [0-9] (#66) 2021-02-25 09:49:47 +08:00
Yanzhen Yu
a591a53195 safe access iframe document 2021-02-18 11:59:41 +08:00
Yanzhen Yu
d7668efbcf add iframe load timeout 2021-02-10 21:26:07 +08:00
yz-yu
98aa732d17 nested record iframe (#63)
* pick nested branch

* iframe snapshot

* temp: add bundle file to git

* revert ignore file

* refactor iframe impl
1. do callback one iframe is loaded, let rrweb handle the rest
2. handle iframe as normal element in rebuild

* rename hook function
2021-02-07 14:00:22 +08:00
Yanzhen Yu
c7f4c36702 fix href value 2021-02-04 14:48:28 +08:00
丶Cccccc
98cc4ee709 bugfix: svg url中id name被误转为绝对路径 (#59)
Co-authored-by: wanglei002 <wanglei002@sensorsdata.cn>
2021-01-16 21:22:45 +08:00
cgf
e1c90aae9a svg xlink:href 路径问题 (#55)
* feat: 修改在svg , xlink:href 相对路径改为绝对路径

* feat: 修改在svg , xlink:href 路径

* feat: 修改在svg, 图片路径问题

* feat: 修改在svg, 图片路径问题

* feat: 修改在svg , xlink:href 路径

Co-authored-by: caogf <caogf@guahao.com>
2021-01-16 21:21:52 +08:00
Yanzhen Yu
1cc7164f2c fix https://github.com/rrweb-io/rrweb-snapshot/issues/56
safe access tagName of form element
2020-12-21 12:37:13 +08:00
Yanzhen Yu
6c2d85049a fix https://github.com/rrweb-io/rrweb/issues/395 2020-11-29 14:37:11 +08:00
Yanzhen Yu
852632656f refactoring public API 2020-11-29 13:22:01 +08:00
Yanzhen Yu
555398d3f5 close #38, update data uri regexp 2020-11-21 11:05:08 +08:00
Yanzhen Yu
da182f4927 fix lint 2020-11-21 11:03:43 +08:00
Karl-Aksel Puulmann
036d3df692 Allow blocking elements by selector (#50)
* 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.
2020-10-24 16:11:39 +08:00
Eoghan Murray
14bdd67459 Add ability to reset the mapping id, to facilitate destructor in rrweb (rrwebRecord.stop) (#49) 2020-10-24 16:10:51 +08:00
Eoghan Murray
b3e7d5a476 Prefer a map and a join as feel it's easier to understand, and I found a case in the wild where Array.prototype.reduce was overwritten (which admittedly is also a danger with map) (#52) 2020-10-15 13:14:57 +08:00
Eoghan Murray
8b0bc7c505 Preserve url quotes (#47)
* 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??
2020-10-04 20:46:57 +08:00
Eoghan Murray
6728d12b3c Add a slimDOM option to strip out unnecessary parts of the DOM (#36)
* 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
2020-09-20 13:00:44 +08:00
Yanzhen Yu
8565b0d692 close #42 fallback to html when doctype is invalid 2020-09-06 16:59:03 +08:00
Yanzhen Yu
94ea611790 add an option to enable/disable take canvas snapshot 2020-08-22 15:49:55 +08:00
Yanzhen Yu
3c406bd49f rename visit to visitSnapshot 2020-08-22 15:43:50 +08:00
Yanzhen Yu
9bf1ced656 add visit function for snapshot 2020-08-22 15:43:50 +08:00
Yanzhen Yu
e54218be19 provide a general visit function to modify rebuilt id node map 2020-08-22 15:43:50 +08:00
Eoghan Murray
ae476d25a9 Expand what is considered to be a valid tag name to include underscores: (#41)
- 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
2020-08-21 23:35:17 +08:00
Jason Barry
db28bc4428 Fixes missing space when converting srcset to use absolute URLs (#40)
* Fixes missing space when converting srcset to use absolute URLs

* Fix integration snapshot
2020-08-05 10:09:59 +08:00
吴泽康
f7d43f5fee Add nested scroll support (#31) 2020-07-25 15:05:45 +08:00
Yanzhen Yu
785ff391b9 add textarea and select to default options 2020-07-18 14:08:36 +08:00
Yanzhen Yu
9ea534505f support mask select fields 2020-07-18 13:58:09 +08:00
Yanzhen Yu
3ebdcbdf03 fix mask textarea 2020-07-18 13:50:47 +08:00
Yanzhen Yu
e4593ff76d part of rrweb #80, support configure mask input types 2020-07-18 13:31:32 +08:00
Eoghan Murray
63c3bd744e Don't obscure text of form buttons under maskAllInputs (more modern style would be a <button>) (#35) 2020-07-17 23:17:07 +08:00
Maxim Postautov
341b1858b9 add '-' to symbolAndNumberRegex (#34) 2020-06-06 21:14:09 +08:00