-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: addHoverClass creating invalid css #1379
Comments
I'm having a similar issue to the one described above. Here is some more detail that I was able to gather. The issue I hit is with how While these selectors are not ideal, the app I found the issue with was using this framework that appends an html attribute ( I did try to implement a fix locally and was successful for the recording in which I discovered the issue. I created a jest test case (below) and was able to get it to pass, but the regex update I tried (inside Test case I would expect to pass: it('parses { and } in attribute selectors correctly', () => {
const result = parse('foo[someAttr~="{someId}"] { color: red; }');
const rules = result.stylesheet!.rules;
expect(rules.length).toEqual(1);
const rule = rules[0] as Rule;
expect(rule.selectors![0]).toEqual('foo[someAttr~="{someId}"]');
}); In searching the rrweb issues this, I found evidence which pointed me to Lastly, I was also able to create a demo recording (link to gist and recording) to see what this looks like in a player. And for comparison, here is a gif of what the test page should actually do. |
Ok I think I've found a fix for both my issue and the issue raised by @jaj1014 using https://github.com/NxtChg/pieces/blob/master/js/css_parser/css_parse.js as a basis |
* Fix known issues * Run format * Fix linting errors * Add comment in code for source of match logic * Add changeset
* Fix known issues * Run format * Fix linting errors * Add comment in code for source of match logic * Add changeset
Preflight Checklist
What package is this bug report for?
rrweb-snapshot
Version
2.0.0-alpha.11
Expected Behavior
Styling should work
Actual Behavior
Replay is crashing due to stylesheet becoming invalid on replay from the addHoverClass function
Steps to Reproduce
Is you have a selector like
then it will be replaced in the
addHoverClass
byWhich is invalid css.
It looks to be something to do with the logic in the parsing, where the selectors looks like
[_nghost-ng-c4172599085]:not(.fit-content).aim-select:hover:not(:disabled
Which is then getting fed into the addHoverClass function
Testcase Gist URL
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: