Commit Graph

75 Commits

Author SHA1 Message Date
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
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
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
James Bradley
86cf78822d H tags (#28)
* Failing test

* Allow numbers in el name tests

* Allow numbers in el names
2020-03-10 22:33:23 +08:00
Fizer Khan (பைசர் கான்)
7da67ec182 fix null issue. (#27) 2020-02-25 15:52:38 +08:00
Yanzhen Yu
b5e9b40f4d close #24 css text can be null 2020-01-26 20:08:52 +08:00
Yanzhen Yu
a7a3a76af1 add media state check 2020-01-12 18:01:37 +08:00
Filip Slatinac
f1cae2f68c added cssText check (#23)
* added cssText check

* added testing
2019-11-27 14:17:00 +08:00
Filip Slatinac
acb53f2ef1 replacing invalid tag names by div (#22) 2019-11-25 21:28:20 +08:00
Yanzhen Yu
2af6e7af7f export the transform attribute method 2019-11-09 15:28:04 +08:00
Yanzhen Yu
0b3b630c60 format code 2019-11-09 15:21:36 +08:00
吴泽康
358d5e0d50 Add canvas image content support (#20)
* Add canvas image content support

* use rr_dataURL as the key so we know its a rrweb-added attribute.

* fix canvas rr_dataURL rebuild
2019-10-12 17:02:24 +08:00
Filip Slatinac
30bbd9e21d Added srcset support (#18)
* added src set as a parsed attribute

* added tests

* changed to /a

* added multiple attribute handling

* added better comment

* made snapshot ignore invalid input as if it is invalid input in the original DOM, it should stay invalid in the recreated DOM

* added extra absolute test case

* code style

* addressed comments
2019-10-01 11:32:50 +08:00
Yanzhen Yu
a69791b7f5 fix data url regexp 2019-08-31 16:13:02 +08:00
Yanzhen Yu
13a2985d48 pass mask all input option recursively 2019-08-11 20:43:09 +08:00
Yanzhen Yu
b22ccd6bc0 fix #14 fix innerText cap issue 2019-08-04 14:40:54 +08:00
Yanzhen Yu
77c7053751 add mask all inputs option to snapshot 2019-06-15 14:41:36 +08:00
Yanzhen Yu
40da9ffa2f format code 2019-05-26 16:05:47 +08:00
Benoît Zugmeyer
5697c689d9 reuse serialized nodes ids (#12)
* reuse serialized nodes ids

With this patch, each DOM node keeps its id during its existence. This
allows to apply RRWeb events to previous snapshots if needed.

`resetId` has been removed because it loses its meaning: calling it
would not reset the existing nodes ids anymore, only the new ones.

Since we don't reset the id anymore, we may exhaust the available ids
quicker, but Number.MAX_SAFE_INTEGER (2 ** 53 - 1) is pretty large, so I
doubt this'll cause any problem.

* improv TS typing

The `nAsINode` variable was not very elegant.  Simplify this by removing
the cast, and make the INode interface compatible with Node.

* update typings
2019-05-21 17:55:43 +08:00
Yanzhen Yu
0f30dc288c pass inline stylesheet option to iteratly 2019-05-12 21:06:38 +08:00
Yanzhen Yu
724b67f166 add inline option which can bypass the inline stylesheet 2019-05-12 16:04:14 +08:00
Whalefreezer
78c8c11e6b add support for css @import rules (#11) 2019-05-06 21:56:33 +08:00
Yanzhen Yu
6218745a75 update typings 2019-04-14 15:59:22 +08:00
Yanzhen Yu
171d7b39b6 accept RegExp type block class config 2019-04-14 15:55:34 +08:00
Sam Mason
03c9fde822 Make block css class optional & fix test (#6)
* Make block class optional

* Fix test by removing unexpected space space
2019-04-01 10:30:52 +08:00
Yanzhen Yu
687c710fe9 iterate style element to get css rules string 2019-02-17 16:34:28 +08:00
Yanzhen Yu
c4c147649c handle empty url path 2019-01-24 18:39:57 +08:00
Yanzhen Yu
7c275cbf2c fix the format and use window.location 2018-12-30 21:50:04 +08:00