rrweb-io / rrweb

record and replay the web

Home Page:https://www.rrweb.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: use blockSelector to mask img record will throw error: e.matches is not a function

palinchen opened this issue · comments

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

2.0.0-alpha.4

Expected Behavior

The el matches is not a function, may happen in some el which it's nodetype not be 1
make a judgment before use.

Actual Behavior

Uncaught TypeError: e.matches is not a function
at Nt (:1:79872)
at Kt.genAdds (:1:89039)
at :1:88018
at NodeList.forEach ()
at Kt.processMutation (:1:88002)
at Array.forEach ()
at Kt.processMutations (:1:83315)

Steps to Reproduce

1、use rrweb record
2、set blockSelector option : img,svg,canvas

Testcase Gist URL

No response

Additional Information

No response

el.matches is not function when el is textNode (node type is 3)

Great catch.

With maskTextSelector we handle this using a function needMaskingText which jumps to the parent node when the node is not an element node.
Are you in a position to create a PR along similar lines?

Also getting this 😬